retrive a values from dropdown list while assign at a run time...

Posted by Neelimprasanna under ASP.NET on 6/22/2011 | Points: 10 | Views : 1995 | Status : [Member] | Replies : 3
hai.......
i assign a values to dropdown list at runtime....and i selected any one value to dropdown list and i click submit button.....those values in the drop down list to be cleared it....now i wnat a output as those values can not be cleared what iam selected in the drop down list ...so please as early as possible send me the reply....




Responses

Posted by: Meyammai on: 6/22/2011 [Member] Starter | Points: 25

Up
0
Down
Hi,

you said your binding the dropdown dynamically. Are your binding the dropdown on every postback of the page?

if you dont want the value to be cleared on page refresh ( eg: on click of submit button), then bind the dropdown always on page load. bcoz for every server side event, page load event will occur.

Meyammai

Neelimprasanna, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Chvrsri on: 6/22/2011 [Member] [Moderator] [MVP] Silver | Points: 25

Up
0
Down
Hi Neelimprasanna ,

Generally during the page life cycle these events will be called in an order :

Step 1
: Intially OnInit Event will be called.
Step 2
: Controls are loaded with the values in View State this happens during postback
Step 3
: Now it sets the values to those controls and then finally
Step 4
: The Page Load event will be fired

So now what you have to do is enable your view state at the control level.

Here there is a small problem that you re populate the values in Page_Load and clear the selected value so kindly specify this condition in your Page_Load event as
(!IsPostback) //{ Now bind the values }


Hope this helps !!!

Thanks,
Radha Srikanth

Neelimprasanna, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Lakn2 on: 6/23/2011 [Member] Starter | Points: 25

Up
0
Down
for maintain page state when page is refreshed you can use update panel control or

put smartnavigation="true" in page directive .for using update panel,first place scriptmanger on your asp.net page and then updatepanel in that on tag is there under place all your source code. so page don't loss values.

Thanks&Regards
LakshmiNarayana Nalluri.

Neelimprasanna, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response