Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use data from *.aspx.cs file in aspx??

Status
Not open for further replies.

passs

Programmer
Dec 29, 2003
170
RU
Hello everybody!
Sorry, maybe i'm just too stupid, but how can i use some data from *.aspx.cs in aspx file. For example:

//some layer in aspx
<DIV id=&quot;Layer1&quot; runat=&quot;server&quot; style=&quot;Z-INDEX: 111; LEFT: 320px; WIDTH: 100px; POSITION: absolute; TOP: 232px; HEIGHT: 100px&quot; ms_positioning=&quot;FlowLayout&quot;><% Response.Write(sides);%></DIV>

// and in aspx.cs:
namespace MediaApplication
{
public class main : System.Web.UI.Page
{
int sides = 515;
.....

But it doesn't work. What have i to type in Response to use this variable?

Will be very thankful for any kind of help!

Best regards,
Alexander
 
why don't u try on label

at aspx
<body>
.
.
.
<asp:Label id = &quot;testing&quot; runat=server/>
.
.
.
</body>

at aspx.cs
private void Page_Load(object sender, System.EventArgs e)
{
int side = 515;
testing.Text = side;
}

very easy rite?
 
Hey, VikNick!

Yeah, you're right! One more time i'm suprised with my stupidity:))
Thank you, that is much easier!

By the way, may be you know how to declare an array of images?
I'm trying this way:
System.Web.UI.WebControls.Image[] myImage = new System.Web.UI.WebControls.Image[20];

but can not use it. I tried that way:
private void butAdd_Click(object sender, System.EventArgs e)
{
myImage[iCount].Style[&quot;Left&quot;] = &quot;150&quot;;
myImage[iCount].Style[&quot;Top&quot;] = yCount.ToString();
myImage[iCount].Visible = true;
yCount +=20;
iCount++;
}

iCount and yCount declared befor. But clicking this button none image apear.
I dont know why:)
May be you know where are my mistakes?

Thank you!

Best regards,
Alexander
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top