473,405 Members | 2,344 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,405 software developers and data experts.

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 ONSELECTEDINDEXCHANGED.

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_Click(ByVal sender As System.Object, ByVal e As
System.Web.UI.ImageClickEventArgs) Handles imgShasTab.Click
Response.Redirect("~/advanced/default.aspx?pageID=shas")
End Sub
--
_____
DC G
Nov 18 '05 #1
5 1302
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 ONSELECTEDINDEXCHANGED.

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_Click(ByVal sender As System.Object, ByVal e As
System.Web.UI.ImageClickEventArgs) Handles imgShasTab.Click
Response.Redirect("~/advanced/default.aspx?pageID=shas")
End Sub


Using Response.Redirect 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.Redirect, and do the swapping in
imgShasTab_Click .

--

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

Ok, so I tried:

Private Sub imgShasTab_Click(ByVal sender As System.Object, ByVal e As
System.Web.UI.ImageClickEventArgs) Handles imgShasTab.Click

shas1.Visible = True
Me.Visible = False

End Sub

This Sub imgShasTab_Click 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$**************@TK2MSFTNGP15.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 ONSELECTEDINDEXCHANGED.

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_Click(ByVal sender As System.Object, ByVal e As
System.Web.UI.ImageClickEventArgs) Handles imgShasTab.Click
Response.Redirect("~/advanced/default.aspx?pageID=shas")
End Sub


Using Response.Redirect 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.Redirect, and do the swapping in
imgShasTab_Click .

--

Jos

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

_____
DC G

"DC Gringo" <dc******@visiontechnology.net> wrote in message
news:u8**************@TK2MSFTNGP15.phx.gbl...
Well that certainly makes sense.

Ok, so I tried:

Private Sub imgShasTab_Click(ByVal sender As System.Object, ByVal e As
System.Web.UI.ImageClickEventArgs) Handles imgShasTab.Click

shas1.Visible = True
Me.Visible = False

End Sub

This Sub imgShasTab_Click 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$**************@TK2MSFTNGP15.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 ONSELECTEDINDEXCHANGED.

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_Click(ByVal sender As System.Object, ByVal e As
System.Web.UI.ImageClickEventArgs) Handles imgShasTab.Click
Response.Redirect("~/advanced/default.aspx?pageID=shas")
End Sub


Using Response.Redirect 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.Redirect, and do the swapping in
imgShasTab_Click .

--

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******@visiontechnology.net> wrote in message
news:ea**************@TK2MSFTNGP10.phx.gbl...
Anyone? A little help on this?

_____
DC G

"DC Gringo" <dc******@visiontechnology.net> wrote in message
news:u8**************@TK2MSFTNGP15.phx.gbl...
Well that certainly makes sense.

Ok, so I tried:

Private Sub imgShasTab_Click(ByVal sender As System.Object, ByVal e As
System.Web.UI.ImageClickEventArgs) Handles imgShasTab.Click

shas1.Visible = True
Me.Visible = False

End Sub

This Sub imgShasTab_Click 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$**************@TK2MSFTNGP15.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 ONSELECTEDINDEXCHANGED.
> >
> > 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_Click(ByVal sender As System.Object, ByVal e
> > As
> > System.Web.UI.ImageClickEventArgs) Handles imgShasTab.Click
> > Response.Redirect("~/advanced/default.aspx?pageID=shas")
> > End Sub
>
> Using Response.Redirect 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.Redirect, and do the swapping in
> imgShasTab_Click .
>
> --
>
> 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**************@TK2MSFTNGP10.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******@visiontechnology.net> wrote in message
news:ea**************@TK2MSFTNGP10.phx.gbl...
Anyone? A little help on this?

_____
DC G

"DC Gringo" <dc******@visiontechnology.net> wrote in message
news:u8**************@TK2MSFTNGP15.phx.gbl...
Well that certainly makes sense.

Ok, so I tried:

Private Sub imgShasTab_Click(ByVal sender As System.Object, ByVal e As
System.Web.UI.ImageClickEventArgs) Handles imgShasTab.Click

shas1.Visible = True
Me.Visible = False

End Sub

This Sub imgShasTab_Click 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$**************@TK2MSFTNGP15.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 ONSELECTEDINDEXCHANGED.
> >
> > 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_Click(ByVal sender As System.Object, ByVal e
> > As
> > System.Web.UI.ImageClickEventArgs) Handles imgShasTab.Click
> > Response.Redirect("~/advanced/default.aspx?pageID=shas")
> > End Sub
>
> Using Response.Redirect 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.Redirect, and do the swapping in
> imgShasTab_Click .
>
> --
>
> Jos
>
>



Nov 18 '05 #6

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

Similar topics

0
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...
5
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....
6
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...
3
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...
2
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...
0
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...
1
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...
1
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...
1
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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:
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...
0
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...
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.