473,699 Members | 2,813 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

maintain viewstate in listboxes

I have an asp.net vb page with two web user controls on it. The first user
control, uc1.ascx has a series of list boxes that are populated in series by
each other with ONSELECTEDINDEX CHANGED.

In the second control, uc2.ascx, lower down on the page, there is an
imagebutton. When the imagebutton is clicked, it goes to the same page with
a change in url parameter pageID. The control mentioned above sticks
around, while the second one is swapped out for another web user control,
uc3.ascx.

The values populated and selections in the listbox in the uc1.ascx are
getting lost despite viewstate being enabled as true.

What is going on?

The imagebutton looks like this:

Private Sub imgShasTab_Clic k(ByVal sender As System.Object, ByVal e As
System.Web.UI.I mageClickEventA rgs) Handles imgShasTab.Clic k
Response.Redire ct("~/advanced/default.aspx?pa geID=shas")
End Sub
--
_____
DC G
Nov 18 '05 #1
5 1316
Jos
DC Gringo wrote:
I have an asp.net vb page with two web user controls on it. The
first user control, uc1.ascx has a series of list boxes that are
populated in series by each other with ONSELECTEDINDEX CHANGED.

In the second control, uc2.ascx, lower down on the page, there is an
imagebutton. When the imagebutton is clicked, it goes to the same
page with a change in url parameter pageID. The control mentioned
above sticks around, while the second one is swapped out for another
web user control, uc3.ascx.

The values populated and selections in the listbox in the uc1.ascx are
getting lost despite viewstate being enabled as true.

What is going on?

The imagebutton looks like this:

Private Sub imgShasTab_Clic k(ByVal sender As System.Object, ByVal e As
System.Web.UI.I mageClickEventA rgs) Handles imgShasTab.Clic k
Response.Redire ct("~/advanced/default.aspx?pa geID=shas")
End Sub


Using Response.Redire ct causes all viewstate to be lost.
With Redirect, you call the page as if it is the first time.

I suggest you omit the Response.Redire ct, and do the swapping in
imgShasTab_Clic k .

--

Jos
Nov 18 '05 #2
Well that certainly makes sense.

Ok, so I tried:

Private Sub imgShasTab_Clic k(ByVal sender As System.Object, ByVal e As
System.Web.UI.I mageClickEventA rgs) Handles imgShasTab.Clic k

shas1.Visible = True
Me.Visible = False

End Sub

This Sub imgShasTab_Clic k is in the same control as the imagebutton control.
The result is that the Me.Visible = False part works, but the shas1.visible
part does not.

What am I doing wrong?

_____
DC G

"Jos" <jn************ *@fastmail.fm> wrote in message
news:u$******** ******@TK2MSFTN GP15.phx.gbl...
DC Gringo wrote:
I have an asp.net vb page with two web user controls on it. The
first user control, uc1.ascx has a series of list boxes that are
populated in series by each other with ONSELECTEDINDEX CHANGED.

In the second control, uc2.ascx, lower down on the page, there is an
imagebutton. When the imagebutton is clicked, it goes to the same
page with a change in url parameter pageID. The control mentioned
above sticks around, while the second one is swapped out for another
web user control, uc3.ascx.

The values populated and selections in the listbox in the uc1.ascx are
getting lost despite viewstate being enabled as true.

What is going on?

The imagebutton looks like this:

Private Sub imgShasTab_Clic k(ByVal sender As System.Object, ByVal e As
System.Web.UI.I mageClickEventA rgs) Handles imgShasTab.Clic k
Response.Redire ct("~/advanced/default.aspx?pa geID=shas")
End Sub


Using Response.Redire ct causes all viewstate to be lost.
With Redirect, you call the page as if it is the first time.

I suggest you omit the Response.Redire ct, and do the swapping in
imgShasTab_Clic k .

--

Jos

Nov 18 '05 #3
Anyone? A little help on this?

_____
DC G

"DC Gringo" <dc******@visio ntechnology.net > wrote in message
news:u8******** ******@TK2MSFTN GP15.phx.gbl...
Well that certainly makes sense.

Ok, so I tried:

Private Sub imgShasTab_Clic k(ByVal sender As System.Object, ByVal e As
System.Web.UI.I mageClickEventA rgs) Handles imgShasTab.Clic k

shas1.Visible = True
Me.Visible = False

End Sub

This Sub imgShasTab_Clic k is in the same control as the imagebutton control. The result is that the Me.Visible = False part works, but the shas1.visible part does not.

What am I doing wrong?

_____
DC G

"Jos" <jn************ *@fastmail.fm> wrote in message
news:u$******** ******@TK2MSFTN GP15.phx.gbl...
DC Gringo wrote:
I have an asp.net vb page with two web user controls on it. The
first user control, uc1.ascx has a series of list boxes that are
populated in series by each other with ONSELECTEDINDEX CHANGED.

In the second control, uc2.ascx, lower down on the page, there is an
imagebutton. When the imagebutton is clicked, it goes to the same
page with a change in url parameter pageID. The control mentioned
above sticks around, while the second one is swapped out for another
web user control, uc3.ascx.

The values populated and selections in the listbox in the uc1.ascx are
getting lost despite viewstate being enabled as true.

What is going on?

The imagebutton looks like this:

Private Sub imgShasTab_Clic k(ByVal sender As System.Object, ByVal e As
System.Web.UI.I mageClickEventA rgs) Handles imgShasTab.Clic k
Response.Redire ct("~/advanced/default.aspx?pa geID=shas")
End Sub


Using Response.Redire ct causes all viewstate to be lost.
With Redirect, you call the page as if it is the first time.

I suggest you omit the Response.Redire ct, and do the swapping in
imgShasTab_Clic k .

--

Jos


Nov 18 '05 #4
Can you put some javascript in the onload event to investigate what the
visibility property is at the time the page loads?

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
"DC Gringo" <dc******@visio ntechnology.net > wrote in message
news:ea******** ******@TK2MSFTN GP10.phx.gbl...
Anyone? A little help on this?

_____
DC G

"DC Gringo" <dc******@visio ntechnology.net > wrote in message
news:u8******** ******@TK2MSFTN GP15.phx.gbl...
Well that certainly makes sense.

Ok, so I tried:

Private Sub imgShasTab_Clic k(ByVal sender As System.Object, ByVal e As
System.Web.UI.I mageClickEventA rgs) Handles imgShasTab.Clic k

shas1.Visible = True
Me.Visible = False

End Sub

This Sub imgShasTab_Clic k is in the same control as the imagebutton

control.
The result is that the Me.Visible = False part works, but the

shas1.visible
part does not.

What am I doing wrong?

_____
DC G

"Jos" <jn************ *@fastmail.fm> wrote in message
news:u$******** ******@TK2MSFTN GP15.phx.gbl...
> DC Gringo wrote:
> > I have an asp.net vb page with two web user controls on it. The
> > first user control, uc1.ascx has a series of list boxes that are
> > populated in series by each other with ONSELECTEDINDEX CHANGED.
> >
> > In the second control, uc2.ascx, lower down on the page, there is an
> > imagebutton. When the imagebutton is clicked, it goes to the same
> > page with a change in url parameter pageID. The control mentioned
> > above sticks around, while the second one is swapped out for another
> > web user control, uc3.ascx.
> >
> > The values populated and selections in the listbox in the uc1.ascx
> > are
> > getting lost despite viewstate being enabled as true.
> >
> > What is going on?
> >
> > The imagebutton looks like this:
> >
> > Private Sub imgShasTab_Clic k(ByVal sender As System.Object, ByVal e
> > As
> > System.Web.UI.I mageClickEventA rgs) Handles imgShasTab.Clic k
> > Response.Redire ct("~/advanced/default.aspx?pa geID=shas")
> > End Sub
>
> Using Response.Redire ct causes all viewstate to be lost.
> With Redirect, you call the page as if it is the first time.
>
> I suggest you omit the Response.Redire ct, and do the swapping in
> imgShasTab_Clic k .
>
> --
>
> Jos
>
>



Nov 18 '05 #5
I'd be happy to, could I get a code sample?

_____
DC G

"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message
news:ux******** ******@TK2MSFTN GP10.phx.gbl...
Can you put some javascript in the onload event to investigate what the
visibility property is at the time the page loads?

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
"DC Gringo" <dc******@visio ntechnology.net > wrote in message
news:ea******** ******@TK2MSFTN GP10.phx.gbl...
Anyone? A little help on this?

_____
DC G

"DC Gringo" <dc******@visio ntechnology.net > wrote in message
news:u8******** ******@TK2MSFTN GP15.phx.gbl...
Well that certainly makes sense.

Ok, so I tried:

Private Sub imgShasTab_Clic k(ByVal sender As System.Object, ByVal e As
System.Web.UI.I mageClickEventA rgs) Handles imgShasTab.Clic k

shas1.Visible = True
Me.Visible = False

End Sub

This Sub imgShasTab_Clic k is in the same control as the imagebutton

control.
The result is that the Me.Visible = False part works, but the

shas1.visible
part does not.

What am I doing wrong?

_____
DC G

"Jos" <jn************ *@fastmail.fm> wrote in message
news:u$******** ******@TK2MSFTN GP15.phx.gbl...
> DC Gringo wrote:
> > I have an asp.net vb page with two web user controls on it. The
> > first user control, uc1.ascx has a series of list boxes that are
> > populated in series by each other with ONSELECTEDINDEX CHANGED.
> >
> > In the second control, uc2.ascx, lower down on the page, there is an > > imagebutton. When the imagebutton is clicked, it goes to the same
> > page with a change in url parameter pageID. The control mentioned
> > above sticks around, while the second one is swapped out for another > > web user control, uc3.ascx.
> >
> > The values populated and selections in the listbox in the uc1.ascx
> > are
> > getting lost despite viewstate being enabled as true.
> >
> > What is going on?
> >
> > The imagebutton looks like this:
> >
> > Private Sub imgShasTab_Clic k(ByVal sender As System.Object, ByVal e
> > As
> > System.Web.UI.I mageClickEventA rgs) Handles imgShasTab.Clic k
> > Response.Redire ct("~/advanced/default.aspx?pa geID=shas")
> > End Sub
>
> Using Response.Redire ct causes all viewstate to be lost.
> With Redirect, you call the page as if it is the first time.
>
> I suggest you omit the Response.Redire ct, and do the swapping in
> imgShasTab_Clic k .
>
> --
>
> Jos
>
>



Nov 18 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1496
by: john walsh | last post by:
as the subject reads... if you fill an asp.net listbox with items from javascript and then submit the form, even if the listbox's enableviewstate is set to true, it will not retain the items inserted from the javascript...It will maintain any items inserted on the server side... Is this normal?
5
5157
by: Dominic | last post by:
My question is about how to maintain view state in mobile ASP.NET across postback / request in a web farm environment. First of all, let's assume the web-farm does NOT use stick-session feature. In other words, different web servers may serve different requests in the SAME session. In non-mobile ASP.NET, my understanding is that the view state information is passed between each client browser and server with every post-back. Even if...
6
2547
by: sonic | last post by:
Hi, I am experimenting with different viewstate management ideas for large datagrids, and found a microsoft suggestion to turn it off, and only store relevant information by manually accessing viewstate. as per some helpful suggestins in MSDN "Common DataGrid Mistakes" http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/aspnet-commondatagridmistakes.asp they suggest disabling datagrid viewstate and adding...
3
4566
by: RCS | last post by:
I have an app that I have different "sections" that I want to switch back and forth from, all while having the server maintain viewstate for each page. In other words, when I am on Page1.aspx and set textboxes, radio buttons, etc - that viewstate is fine. Then I have a linkbutton that does a Server.Transfer over to Page2.aspx. When I Server.Transfer back to Page1.aspx, the viewstate info is lost. I ran across another example of this last...
2
1160
by: Abhilash | last post by:
Hi, I have the following requirement but i am not sure how to tackle it. I have two sever controls called Editor1 and Editor2 that contains a text box with enableview state = true. Based on a url parameter "show=Editor1" or "show=Editor2" only one fo the server controls is displayed to the user. The other is hidden.
0
1977
by: Subzizo | last post by:
i have a template field in a gridview,i modified the edititem template for a field to represent a dropdownlist instead of the textbox,i need to make set of server side code when the user changes the select dropdownlist, although i turned on autopost back and the enable viewstate properties of the ddl the selected item is not maintained when the page is reloaded and so the server side code dosn't work correct? thank you for help
1
1309
by: amolfarkade | last post by:
Hi, I am using the user control inside the repeater control which is having dropdownlist controls but while post back i need to bind the repeater every time so i can not take the selected of dropdown list. How can i get the dropdownlist's selected value which is in side the user control Thanks
1
1212
jeffstl
by: jeffstl | last post by:
New to asp.net.....so far Im not sure exactly how to use the ispostback and if that is even related to what I'm trying to do. I have a datagrid which I have populated on page_load. I have a buttonlink above it which will hide and unhide the datagrid. The default is for the datagrid to be hidden, when the user clicks it is visible, they can click again to hide. I want to maintain this view when they navigate off the page and return. Do...
1
2055
by: bgernon | last post by:
I have a table that consists of two rows with three cells each row. The cells contain textboxes. I am able to successfully add a new row with textboxes when a button is clicked. The problem is retaining the newly added row with the filled in textboxes on the next button click. I think I am handling my viewstate incorrectly. This code adds the new row: Private Sub addRowsInTable() Dim TextID As Integer Dim TextIDCount...
0
8687
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
8914
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8884
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7751
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6534
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5875
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4376
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4629
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2347
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.