473,397 Members | 2,099 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

How to link multiple .aspx WebForms together?

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
3 3565
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: JD | last post by:
Hi, I am using VS.NET 2003 with MFC7 and I have a link error: I use a library dll built with VC60 and mfc4.2, I have the export lib and include file for that library. The dll implements a Document...
1
by: Jerry Tovar | last post by:
I am using .Net 2003 on a XPPro running IIS. I am unable to view any of my ASPX webforms in a browser unless I modify the .ASPX file and replace Codebehind="employee.aspx.cs" with...
1
by: LidorP | last post by:
Hello All, My problem is as follows: I have an assembly which holds a number of WebForms. In order to use these WebForms in my WebApplication i have to extract them out of the assembly (using...
2
by: Luis E Valencia | last post by:
I want a row of the datagrid with a personalized link. The fields of the link are on the select related to the datagrid the link would be accoiones.aspx?iddireccion=2&idindicador=5 I tried...
0
by: Luis E Valencia | last post by:
Read from above to top. I didnt understand. This is the code that fills that datagrid Public Sub pasar(ByVal sender As System.Object, ByVal e As...
3
by: Saket Mundra | last post by:
I have multiple web forms in my application. The user after logging on is directed to form1 where he enters information desired. Once finished he is directed to form2 and the same procedure goes on...
3
by: rachel | last post by:
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...
1
by: monskie | last post by:
Hello to all, I have a problem which could be trivial to you guys. This concerns opening several crystal reports on the a crystal viewer on an ASPX page by calling window.open. My...
2
by: Michael | last post by:
It seems that a gridview allows us to delete only a single row at a time. How to extend this functionality to select multiple rows and delete all of the selected rows in a single stroke? just like...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.