S
suzy
hi,
i have an aspx page with a button. if i step through my code when i click
the button then it calls the button_Click event which is what i want.
but i need to redirect the page to another aspx page when this button is
clicked so i dont want to waste time rendering the same page before
redirecting, so i put the following code in, but now the button_click event
doesn't get called
what am i doing wrong? how can i render a page the first time its called,
but if the button is clicked , then immediately call the button_Click event.
private void Page_Load(object sender, System.EventArgs e)
{
if (!(Page.IsPostBack))
{
//perform main rendering of the page here.
}
}
by the way, here is my click event code:
private void button_Click(object sender, EventArgs e)
{
Response.Redirect("anotherpage.aspx";
}
i have an aspx page with a button. if i step through my code when i click
the button then it calls the button_Click event which is what i want.
but i need to redirect the page to another aspx page when this button is
clicked so i dont want to waste time rendering the same page before
redirecting, so i put the following code in, but now the button_click event
doesn't get called
what am i doing wrong? how can i render a page the first time its called,
but if the button is clicked , then immediately call the button_Click event.
private void Page_Load(object sender, System.EventArgs e)
{
if (!(Page.IsPostBack))
{
//perform main rendering of the page here.
}
}
by the way, here is my click event code:
private void button_Click(object sender, EventArgs e)
{
Response.Redirect("anotherpage.aspx";
}