Monday, March 26, 2012

Populate controls once

How do I make sure that when an execution is taken back to the server
controls like combos are not populated again?

ThanksIf you populate your controls in the Page_Load event, you can wrap the code that populates the controls in an

If Not Page.isPostBack
...
End If

block. This will only execute the code (within the block) once; when the page loads initially. You can ensure that the data remains in the controls by setting the controls viewstate property to true.

hope this helps,
John

"Mark Goldin" wrote:

> How do I make sure that when an execution is taken back to the server
> controls like combos are not populated again?
> Thanks
>
Thanks, that worked.

"John Sivilla" <JohnSivilla@.discussions.microsoft.com> wrote in message
news:559371D8-5400-46F4-A256-2D3EF6C0BD70@.microsoft.com...
> If you populate your controls in the Page_Load event, you can wrap the
code that populates the controls in an
> If Not Page.isPostBack
> ...
> End If
> block. This will only execute the code (within the block) once; when the
page loads initially. You can ensure that the data remains in the controls
by setting the controls viewstate property to true.
> hope this helps,
> John
> "Mark Goldin" wrote:
> > How do I make sure that when an execution is taken back to the server
> > controls like combos are not populated again?
> > Thanks

0 comments:

Post a Comment