473,837 Members | 1,741 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 1323
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
1504
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
5175
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
2558
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
4579
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
1167
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
1988
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
1317
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
1218
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
2063
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
9846
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...
0
9683
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10883
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10276
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
9412
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...
0
5674
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
5852
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4479
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3126
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.