Problem with DropDownList
-
Hello all, I am dynamically creating DropDownList in my application. While running application, when i select some value in DropDownList it is showing fine, but if i click some other button then DropDownList is always showing its first item. I heard this happens because of PostBack. I tried by setting AutoPostBack property to both true and false, but still same problem occuring both time. Can anyone help me? Thanks, Nagendra.
-
Hello all, I am dynamically creating DropDownList in my application. While running application, when i select some value in DropDownList it is showing fine, but if i click some other button then DropDownList is always showing its first item. I heard this happens because of PostBack. I tried by setting AutoPostBack property to both true and false, but still same problem occuring both time. Can anyone help me? Thanks, Nagendra.
Check that you are not rebinding the dropdownlist when the button click causes the postback.
only two letters away from being an asset
-
Check that you are not rebinding the dropdownlist when the button click causes the postback.
only two letters away from being an asset
This is my code, i am creating DropDownList inside GridView
-
Hello all, I am dynamically creating DropDownList in my application. While running application, when i select some value in DropDownList it is showing fine, but if i click some other button then DropDownList is always showing its first item. I heard this happens because of PostBack. I tried by setting AutoPostBack property to both true and false, but still same problem occuring both time. Can anyone help me? Thanks, Nagendra.
When did you create those Dynamic control. You have to create the dynamic control before
page_load()
, other wise that control will not be able to maintain viewstate and Postback datra, causeLoadViewState()
andLoadPostbackData()
called juts beforepage_load()
. IF you created control before page_load, Try to do this inPage_Load()
if( ! Page.IsPostBack)
{
// Bind Data With Dropdownlist
}
Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.
-
This is my code, i am creating DropDownList inside GridView
You are using it inside Gridview ?
Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.
-
When did you create those Dynamic control. You have to create the dynamic control before
page_load()
, other wise that control will not be able to maintain viewstate and Postback datra, causeLoadViewState()
andLoadPostbackData()
called juts beforepage_load()
. IF you created control before page_load, Try to do this inPage_Load()
if( ! Page.IsPostBack)
{
// Bind Data With Dropdownlist
}
Abhijit Jana | Codeproject MVP Web Site : abhijitjana.net Don't forget to click "Good Answer" on the post(s) that helped you.
i am creating it inseide a GridView