开发者

Show a web form the way we do in WinForms

I am absolutely new to ASP.NET. In WinForms/ VB.NET we can display a form by

form2.show()

In my ASP.NET project, I have created a second webform but don't know how to show it.

Ho开发者_如何学编程w can this be done?


From your code-behind, you can redirect the user to the new page using the HttpResponse's Redirect method:

Response.Redirect("newPage.aspx")

If you want the user to self-navigate to the new page, use a hyperlink server control on your web form:

  <asp:HyperLink id="hyperlink1" 
              NavigateUrl="~/newPage.aspx"
              Text="My New Page"
              runat="server"/>     


You need to link to the second web form using a hyperlink, so in your first webform, having something like this:

<a href="webform2.aspx">My Second WebForm</a>

With a web based programming model, you can't really apply the same programming model.

If you want something to appear as a popup, you could use javascript. I'd recommend taking a look a the jQuery UI Dialog.


Based on your question, I think your best option here is to first go and watch/read some tutorials on using ASP.NET. Programming for the web in a framework like ASP.NET is nothing like working with WinForms, even if you are using the same language (VB.NET). With ASP.NET WebForms they have tried to make the transition easier, but you still need to have a good grasp about how things work in the stateless web world if you really want to be effective. Then you can truly understand the other answers here and WHY you are doing that.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜