Click here to Skip to main content
15,886,664 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

When we are updating the Dropdownlist from the Datatable, the value can not insert into the Dropdownlist it is showing blank only due to selected Index = -1

Kindly help me to resolve this issue.

During Update
C#
ddlcountry.text = dtCountry[0]["Country"].Tostring();

from database dtCountry = 'America'

IN Dropdownlist Source
XML
<asp:UpdatePanel ID="UpdatePanel4" runat="server">
   <ContentTemplate>
      <asp:DropDownList ID="ddlCountry" AutoPostBack ="true"
AppendDataBoundItems ="True" runat="server"
onselectedindexchanged="ddlCountry_SelectedIndexChanged"  Width="200px" >
      </asp:DropDownList>
   </ContentTemplate>
   <Triggers>
    <asp:AsyncPostBackTrigger ControlID ="ddlCountry"
   </Triggers>
</asp:UpdatePanel>
Posted
v3
Comments
[no name] 17-Dec-12 2:08am    
where's your code.. (i.e .cs file's code) ?

1 solution

Drop down selected index always starts from 0. So please give selected index of dropdown as 0 or more then it.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900