Kev Patil

Kev Patil

  • NA
  • 21
  • 4.2k

how to fill dropdownlist inside gridview from sql

Aug 14 2017 9:09 AM
I need help trying to figure out how to autofill data from sql inside gridview into dropdownlist every time there is data in gridview? 
 
I have muiltiple tamplate fields:
 
<asp:TemplateField HeaderText="Hire" ItemStyle-Width="50px">     <ItemTemplate>         <asp:DropDownList ID="ddlGridListHire" runat="server"  AppendDataBoundItems="true" ></asp:DropDownList>     </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Status" ItemStyle-Width="50px">     <ItemTemplate>         <asp:DropDownList ID="ddlGridListStatus" runat="server"  AppendDataBoundItems="true" ></asp:DropDownList>     </ItemTemplate> </asp:TemplateField> <asp:TemplateField HeaderText="Background Check" ItemStyle-Width="50px">     <ItemTemplate>         <asp:DropDownList ID="ddlGridListBackgroundCheck" runat="server"  AppendDataBoundItems="true" ></asp:DropDownList>     </ItemTemplate> </asp:TemplateField>
  
and .cs file is where im struggle. i believe i have to do something inside rowbound?
 
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) 
{ 
}
 Please help.
 
Thank yOu 

Answers (2)