Dropdown list select problem

Posted by Venu510 under ASP.NET on 7/30/2011 | Points: 10 | Views : 1678 | Status : [Member] | Replies : 4
Hi Friends!

I have a problem .In a page i have 2 drop down lists like Gender,Maritalstatus and also have some Radiobutton lists.After data insertion if i want to change any value like changing Gender Male to Female or Marital status or Radio button the values are pointing the previous values only.so that in the data base data is not updating.Can any body help me on this.

Regards
------
Venu




Responses

Posted by: SheoNarayan on: 7/30/2011 [Administrator] HonoraryPlatinum | Points: 25

Up
0
Down
I couldn't get your question completely, however I am guessing that you are not populating the DropDownList from the database in the !IsNotPostback condition that is the reason the database value is getting overwritten on the user selected value.

In the Page_Load event, write following

if (!IsPostBack)

{
// populate the dropdown
}


Thanks

Regards,
Sheo Narayan
http://www.dotnetfunda.com

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

Posted by: Venu510 on: 7/31/2011 [Member] Starter | Points: 25

Up
0
Down
Thank you friend for your replay. go through this link i think it will clear the question.
http://www.immigrationmedical.com/survey.
Friends i tried with autopost back=true property also.It is new to me.I have ddls like

<asp:DropDownList id="ddlGender" runat="server">
<asp:ListItem>Male</asp:ListItem>
<asp:ListItem>FeMale</asp:ListItem>
</asp:DropDownList>
like this i have controls when first time i am entering data it is saving exactly but after come back to prev page and tryng change ddl or radio button values it is keeping the same value in controls so it is updatng with old value only

Regards
-----------
Venu

Thanks & Regards
-----------------
Venu
Dotnet Programmer

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

Posted by: Venu510 on: 8/1/2011 [Member] Starter | Points: 25

Up
0
Down
Hi Friends!

I really thank full to you all for your kind replay.I solved my issue.

Thanks & Regards
----------------
Venu

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

Posted by: Sundarsingh57 on: 8/8/2011 [Member] Starter | Points: 25

Up
0
Down
Set the autopostback=true, You just place your mouse cursor on the drop down list control, Right side you will have a right arrow, Click on that arrow, after that you can find the autopostpack, Just enable the check box of autopostback

Jai Hind

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

Login to post response