Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Problem with Autopostback

Reply
Thread Tools

Problem with Autopostback

 
 
mo
Guest
Posts: n/a
 
      10-22-2004
Hi,

I have a set of Dynamic DropDownLists with AutoPostback. the problem I
have is that when I select the dropdown and the page refreshes the old
values in the text boxes disappear. Is there a way to preserve the
values?

Thanks,
Mo
 
Reply With Quote
 
 
 
 
Jorge Matos
Guest
Posts: n/a
 
      10-22-2004
Make sure you are not accidentally re-initializing your controls. All
controls have viewstate to maintain their values, and therefore in your
Page_Load event you need to make sure you only initialize your drop-downs
when the page is first being requested via HTTP GET request and not during an
HTTP POST request.

inside Page_Load:

public void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
//Initialize drop downs here
}
}

"mo" wrote:

> Hi,
>
> I have a set of Dynamic DropDownLists with AutoPostback. the problem I
> have is that when I select the dropdown and the page refreshes the old
> values in the text boxes disappear. Is there a way to preserve the
> values?
>
> Thanks,
> Mo
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Gridview / autopostback problem postings@alexshirley.com ASP .Net 1 03-31-2006 03:24 PM
Problem with autopostback and .Net 2005 Darcy810 ASP .Net 0 02-15-2006 02:28 PM
Problem with autopostback on webcontrols Sean Chapman ASP .Net 1 01-21-2006 03:22 AM
Problem with Dropdown - ViewState and AutoPostBack Lloyd Sheen ASP .Net 3 11-09-2003 01:14 PM
Problem with Autopostback Jesse ASP .Net 4 07-17-2003 07:35 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57