Code Switching in aspx file

  • Thread starter Thread starter Matt
  • Start date Start date
M

Matt

Have this generic page for update,new,close fields.
Once click on page1 and capture the button click. On second page I only
would like to show whateever button clicked(update,cl,new)
I would do this in asp like below.
<%if page = "update">
<td><update fields</td>
<%else%>
<td><close fields</td>
<%end if%>

I am not using codebehind.
 
In your second page do the following:

if( null != Request.Form["thebuttonidfromthefirstpage"])
{
// do your thing here
}

Make sure that you do a Server.Transfer("secondpage.aspx"); to your second
page. Doing a Response.Redirect("secondpage.aspx"); doesn't save your POST
values.

When you look at this code, you might wonder why you should register an
event for a button click when you know in the page_load which button was
clicked from the above code. (Not just a button either)
I'm not sure what the advantage is to register an event. Any comments on
that?
 
where would i write those code blocks Gaza?
On aspx page it self. where do i do the switching form html to script.
i quess that is my question.
if( null != Request.Form["Update"])
{
<html><for Update>
}

if( null != Request.Form["Close"])
{
<html><for close>
}

would you do something like up there
 
Back
Top