DropDownList refresh on second attempt in gridview asp.net c# -


i facing problem while adding new records selecting drop down items. gridview in select addresstype, country city cityarea , on using dropdown. in first attempt working fine, on second attempt when select country reset selected item.

http://i.stack.imgur.com/gottu.jpg

as can see in above picture, on second attempt going select country. select country refresh. in below picture:

http://i.stack.imgur.com/obet5.jpg

please me find solution. thanks.

here code:

<asp:templatefield headertext="country" headerstyle-width="14%">                         <itemtemplate>                             <asp:label id="lblcountry" text='<%# databinder.eval(container, "dataitem.country.description") %>'                                 runat="server">   </asp:label>                         </itemtemplate>                         <footertemplate>                             <asp:updatepanel runat="server" id="upcountry">                             <contenttemplate>                                 <asp:dropdownlist id="ddlcountrynew" datasourceid="odscountry" runat="server" onselectedindexchanged="ddlcountrynew_selectedindexchanged"                                     autopostback="true" datatextfield="description" datavaluefield="id" cssclass="mywidth-7" />                             </contenttemplate>                             <triggers>                                 <asp:asyncpostbacktrigger controlid="ddlcountrynew" />                             </triggers>                         </asp:updatepanel>                         </footertemplate>                         <edititemtemplate>                             <asp:dropdownlist id="ddlcountry" datasourceid="odscountry" runat="server" selectedvalue='<%# databinder.eval(container, "dataitem.countryid") %>'                                 datatextfield="description" datavaluefield="id" cssclass="mywidth-6" validationgroup="editaddressgroup" />                         </edititemtemplate>                     </asp:templatefield> 

c#:

protected void ddlcountrynew_selectedindexchanged(object sender, eventargs e)     {         dropdownlist ddlcountrynew = (dropdownlist)sender;         hdncountryid.value = ddlcountrynew.selecteditem.value;     } 

if want dropdownlist trigger ajax call without refreshing page

set eventname="selectedindexchanged" below

<triggers>  <asp:asyncpostbacktrigger controlid="ddlcountrynew" eventname="selectedindexchanged" />  </triggers>  

have keen on through update panel msdn document example


Comments

Popular posts from this blog

java - Andrioid studio start fail: Fatal error initializing 'null' -

android - Gradle sync Error:Configuration with name 'default' not found -

StringGrid issue in Delphi XE8 firemonkey mobile app -