Dropdownlist box and Radio Button Display
-
hi I have a dropdownlist box which stores the gender i.e. Male and Female. When i submit the form, depending on the value selected from the dropdownlist , the value get stored in the database as male or Female.Now when i try to edit that patricular record then it always displays the first entry.Same things happens with the radio button...by default it displays the first radio button as selected on the display. Waiting for help... Riz
-
hi I have a dropdownlist box which stores the gender i.e. Male and Female. When i submit the form, depending on the value selected from the dropdownlist , the value get stored in the database as male or Female.Now when i try to edit that patricular record then it always displays the first entry.Same things happens with the radio button...by default it displays the first radio button as selected on the display. Waiting for help... Riz
Hi, U can code like this. ddl.SelectedItem.Text = "three"; or ddl.Items.FindByText("Three").Selected = true; I hope this will helps u. Bye Pessi.
-
hi I have a dropdownlist box which stores the gender i.e. Male and Female. When i submit the form, depending on the value selected from the dropdownlist , the value get stored in the database as male or Female.Now when i try to edit that patricular record then it always displays the first entry.Same things happens with the radio button...by default it displays the first radio button as selected on the display. Waiting for help... Riz
Rajiya, Correct me if I am my understanding is right. You are storing the dropdowlist box value and the radio button value in the database. But you when you retrieve these values from the database to edit you always see the default selection of your .aspx page. Is this right? If so, my guess would be either the program is not saving the values to datbase properly or may be the values aren't being retrieved and handled properly inorder for them to display in your display.aspx page. I would check the database values and the code snippet that is posting the values to the front. Thanks -L
-
Rajiya, Correct me if I am my understanding is right. You are storing the dropdowlist box value and the radio button value in the database. But you when you retrieve these values from the database to edit you always see the default selection of your .aspx page. Is this right? If so, my guess would be either the program is not saving the values to datbase properly or may be the values aren't being retrieved and handled properly inorder for them to display in your display.aspx page. I would check the database values and the code snippet that is posting the values to the front. Thanks -L
hi, Depending upon what is selected from the dropdownlist, appropriate values get stored in the database.But when it is displaying the values then by default always the first value is displayed in the listbox and as well as in the radio button. If i have selected as "Female" from the dropdown list box then in the database it stores as "Female" but when i want to edit that particular record then it shows me as "Male" in the form.Am using ASP.Net and C# to do the coding. Riz
-
Rajiya, Correct me if I am my understanding is right. You are storing the dropdowlist box value and the radio button value in the database. But you when you retrieve these values from the database to edit you always see the default selection of your .aspx page. Is this right? If so, my guess would be either the program is not saving the values to datbase properly or may be the values aren't being retrieved and handled properly inorder for them to display in your display.aspx page. I would check the database values and the code snippet that is posting the values to the front. Thanks -L
In the database it saves the proper value but if i want to edit a value then on the display of the form it shows me the first value as selected from the dropdownlist box as well as Radio Button. For e.g. If I am having "Male" and "Female" in the ddlist and if i have selected "Female" then it will display "Male" by default even though it saves it as "Female" in the database.Am using ASP.Net and C# to do the coding. riz
-
hi I have a dropdownlist box which stores the gender i.e. Male and Female. When i submit the form, depending on the value selected from the dropdownlist , the value get stored in the database as male or Female.Now when i try to edit that patricular record then it always displays the first entry.Same things happens with the radio button...by default it displays the first radio button as selected on the display. Waiting for help... Riz
Populate the dropdown list only if the page is not postbacked.
private void Page_Load(object sender, System.EventArgs e) { if(!Page.IsPostBack) { //code to populate dropdown } }
What you're doing right now is repopulating the dropdown list every time the page is postbacked. regards, Mircea Many people spend their life going to sleep when they’re not sleepy and waking up while they still are.