Dropdownlist not keeping viewstate after postback

D

David Wyn Davies

I have a complex datagrid containing several ASP.NET form elements.
One of the elements is a checkboxlist. This is populated from a
database but the data it is populated with is dependent upon the
current value in one of the datagrid's dropdownlist boxes.

The dropdownlist is set for AutoPostBack. However, when the postback
occurs and the datagrid redisplayed, the dropdownlist doesn't keep the
value it had when postback ocurred.

How do I get around this problem?

Thanks,
David
 
M

Mona

Hi David,

For your query, you would need to check following three things:

1. You need to populate the Dropdown list when the page is not post back,
i.e, If !PostBack then populate it.

2. You need to populate the CheckBox everytime the page loads.

3. Please ensure the Enable.ViewState property is set to true.

HTH

Mona[Grapecity]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,480
Members
44,900
Latest member
Nell636132

Latest Threads

Top