Hi,
I am quite new to C#.NET and ASP and so it is likely that this is a very simple question. Basically I on a particular web form that I am creating a label's text is set on PAGE_LOAD, then basically when a user clicks a button I need to get the Text from this label, but it always returns null. Now I am guessing that this is something to do with the page lifecycle and the code behind not knowing that the label has been updated during the Page_Load but can't seem to see another way of getting this to work. However when I view the page, the lable actually displays that it has been updated with the correct text (not null). Here is a sample of the code.
protected void Page_Load(object sender, EventArgs e)
{
HttpRequest req = Context.Request;
sysName = req["system_list"];
removeLab.Text = sysName;
}
protected void Button1_Click1(object sender, EventArgs e)
{
String sysToDel = removeLab.Text;
HttpResponse res = Context.Response;
res.ClearContent();
res.Write("<html><head></head><body>");
res.Write(sysToDel);
res.Write(sysName); // Just thought I would try this...
res.Write("</body></html>");
res.Flush();
res.Close();
}
Note that the res.Write to the page is just to test to see whether I can get the Text required before completing the rest. Any help that you could give or tutorials that would explain where I am going wrong would be most appreciated. Thank you.