Hi ShihabKhan,
To move from one webform to another on button click you have to use Response.Redirect or Server.Transfer method.
Both Response.Redirect and Server.Transfer methods are used to move from one web page to another web page.
For more details refer below article.
https://docs.microsoft.com/en-us/previous-versions/iis/6.0-sdk/ms524309%28v%3Dvs.90%29
https://docs.microsoft.com/en-us/previous-versions/iis/6.0-sdk/ms525800%28v%3Dvs.90%29
https://www.codeproject.com/Articles/775221/Server-Transfer-VS-Response-Redirect-Simplified
Refer sample example.
HTML
Form1
<h3>Form 1</h3><hr />
<asp:Button Text="Move To Form2" runat="server" OnClick="OnMove" />
Form2
<h3>Form 2</h3><hr />
<asp:Button Text="Move To Form1" runat="server" OnClick="OnMove" />
Code
Form1
C#
protected void OnMove(object sender, EventArgs e)
{
//Server.Transfer("WebForm2.aspx");
Response.Redirect("WebForm2.aspx");
}
VB.Net
Protected Sub OnMove(ByVal sender As Object, ByVal e As EventArgs)
'Server.Transfer("WebForm2.aspx")
Response.Redirect("WebForm2.aspx")
End Sub
Form2
C#
protected void OnMove(object sender, EventArgs e)
{
//Server.Transfer("WebForm1.aspx");
Response.Redirect("WebForm1.aspx");
}
VB.Net
Protected Sub OnMove(ByVal sender As Object, ByVal e As EventArgs)
'Server.Transfer("WebForm1.aspx")
Response.Redirect("WebForm1.aspx")
End Sub
Screenshot
