Monday, March 26, 2012

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 GDC 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
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" <jnospambranders@.fastmail.fm> wrote in message
news:u$3DEIKxEHA.2316@.TK2MSFTNGP15.phx.gbl...
> DC Gringo wrote:
> 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
>
Anyone? A little help on this?
_____
DC G
"DC Gringo" <dcgringo@.visiontechnology.net> wrote in message
news:u8tfluPxEHA.2316@.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" <jnospambranders@.fastmail.fm> wrote in message
> news:u$3DEIKxEHA.2316@.TK2MSFTNGP15.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" <dcgringo@.visiontechnology.net> wrote in message
news:eaL$lQcxEHA.3896@.TK2MSFTNGP10.phx.gbl...
> Anyone? A little help on this?
> _____
> DC G
> "DC Gringo" <dcgringo@.visiontechnology.net> wrote in message
> news:u8tfluPxEHA.2316@.TK2MSFTNGP15.phx.gbl...
> control.
> shas1.visible
>
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:uxdeTnexEHA.3260@.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" <dcgringo@.visiontechnology.net> wrote in message
> news:eaL$lQcxEHA.3896@.TK2MSFTNGP10.phx.gbl...
an
another
>

0 comments:

Post a Comment