By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,761 Members | 1,183 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,761 IT Pros & Developers. It's quick & easy.

How to link multiple .aspx WebForms together?

P: n/a
Hi all,

I am new in ASP.Net. I have a question on link multiple web forms together.

Here is the scenario:

I create an Index.aspx WebForm which consists of a banner and three navigator buttons as well as a body to load the content. It is exactly like a normal HTML page where there are banner, menu bar, and body to load content. In my case, there are three .aspx WebForms which I have to link them together in the Index.aspx page. So that when users click on the navigator button, the corresponding webform will be loaded on the body. For example, users click on view profile navigation button, the profile.aspx page will be loaded in the content body.

From my opinion, the banner and navigator buttons should be created only once. Whereas the body to load the corresponding .aspx WebForms should be dynamic. Meaning, it knows what to load when users click on different buttons.

May I know how to accomplish the above task? By the way, I do not use Frame to separate the banner, navigator buttons, and body to load the webforms. I just use tables to separate them.

Actually, I tried the following codes as the code behind of each menu button in the Index.aspx:
Private Sub ImageButton1_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click
Dim FunExc As New System.IO.StringWriter
Server.Execute("../customer/customeradd.aspx", FunExc)
lblChgDetail.Text = "<h2>Change Details</h2>" & FunExc.ToString
End Sub

Private Sub ImageButton2_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton2.Click
Dim FunExc2 As New System.IO.StringWriter
Server.Execute("../product/packageadd.aspx", FunExc2)
lblChgDetail.Text = "<h2>View Usage</h2>" & FunExc2.ToString
End Sub

However, it works only for the very first click on one menu button. For example, when I click on ImageButton1 at the very first time, the webform customeradd.aspx will be loaded at the body. However, if I clicked ImageButton1 again or clicked ImageButton2 after the first click, it shows the error message: "The viewstate is invalid for this page and might be corrupted."

*Remark: I put the following codes on the index.aspx, customeradd.aspx, and packageadd.aspx (the later two webforms are link by the menu buttons in index.aspx)
'Web Form Designer Generated Code
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.EnableViewState = False
End Sub

Thank you all.
--
Thanks,
rachel
Jul 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Rachel,

Lucky for you Microsoft thought about this long before you did. With
ASP.Net you can easily create custom UserControls. These use controls can
be created very easily and placed like other controls in ASP.Net pages.

Hope that answers your question

"rachel" <ra****@discussions.microsoft.com> wrote in message
news:E9**********************************@microsof t.com...
Hi all,

I am new in ASP.Net. I have a question on link multiple web forms together.
Here is the scenario:

I create an Index.aspx WebForm which consists of a banner and three navigator buttons as well as a body to load the content. It is exactly like
a normal HTML page where there are banner, menu bar, and body to load
content. In my case, there are three .aspx WebForms which I have to link
them together in the Index.aspx page. So that when users click on the
navigator button, the corresponding webform will be loaded on the body. For
example, users click on view profile navigation button, the profile.aspx
page will be loaded in the content body.
From my opinion, the banner and navigator buttons should be created only once. Whereas the body to load the corresponding .aspx WebForms should be
dynamic. Meaning, it knows what to load when users click on different
buttons.
May I know how to accomplish the above task? By the way, I do not use Frame to separate the banner, navigator buttons, and body to load the
webforms. I just use tables to separate them.
Actually, I tried the following codes as the code behind of each menu button in the Index.aspx: Private Sub ImageButton1_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click Dim FunExc As New System.IO.StringWriter
Server.Execute("../customer/customeradd.aspx", FunExc)
lblChgDetail.Text = "<h2>Change Details</h2>" & FunExc.ToString
End Sub

Private Sub ImageButton2_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton2.Click Dim FunExc2 As New System.IO.StringWriter
Server.Execute("../product/packageadd.aspx", FunExc2)
lblChgDetail.Text = "<h2>View Usage</h2>" & FunExc2.ToString
End Sub

However, it works only for the very first click on one menu button. For example, when I click on ImageButton1 at the very first time, the webform
customeradd.aspx will be loaded at the body. However, if I clicked
ImageButton1 again or clicked ImageButton2 after the first click, it shows
the error message: "The viewstate is invalid for this page and might be
corrupted."
*Remark: I put the following codes on the index.aspx, customeradd.aspx, and packageadd.aspx (the later two webforms are link by the menu buttons in
index.aspx) 'Web Form Designer Generated Code
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent() Me.EnableViewState = False
End Sub

Thank you all.
--
Thanks,
rachel

Jul 21 '05 #2

P: n/a
Hi Rachel,

A viewstate is on a page
A session is on the server

Therefore when you need to save information for different pages the best is
in my opinion to use the "session" for that, basicly do you use it in the
same way as the viewstate.

By the way, did you know that there is a newsgroup?

microsoft.public.dotnet.framework.aspnet

I hope this helps?

Cor
Jul 21 '05 #3

P: n/a
Can you provide some codes to illustrate your point? Thanks.

--
Thanks,
rachel
"Cor Ligthert" wrote:
Hi Rachel,

A viewstate is on a page
A session is on the server

Therefore when you need to save information for different pages the best is
in my opinion to use the "session" for that, basicly do you use it in the
same way as the viewstate.

By the way, did you know that there is a newsgroup?

microsoft.public.dotnet.framework.aspnet

I hope this helps?

Cor

Jul 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.