I am making a website using visual studio 2008; in C#. I want my page to navigate after clicking a button...
Handle the
click event for the button and call
Response.Redirect method to redirect to the other page.
For example, if you had a button named "NavigateToNextPage" defined in your asp code like this:
-
<asp:Button id="NavigateToNextPage"
-
Text="Go To Next Page"
-
OnClick="NavigateToNextPage_Click"
-
runat="server"/>
Your C# code could look something like:
-
void NavigateToNextPage_Click(Object sender, EventArgs e)
-
{
-
Response.Redirect("http://theNextPage.aspx");
-
}
And I also don't know how to use anchor tag in c#...
You use the
Hyperlink Class to create anchors in ASP.NET
One more thing, I want to have a drop down list, after clicking a button, but couldn't find any option like that
Add a
DropDownList to your page and set its Visible property to
false
so that the control is never rendered into the HTML by default. Then, in the method that handles the click event for the button that displays the DropDownList, set the Visible property to
true
.
-Frinny