Hi any one help me how to retrive data from the database to a dropdown list which is created in a gridview.
Procedure what i need is, first time you manually added the value to the gridview and save it into the data base.
secound time i have to retrieve data from database what u have saved in database and which is come on the dropdown list.
Code i written in the design part like.
<asp:GridView ID="grdDisplay" runat="server"
AutoGenerateColumns="False" Font-Bold="True"
Font-Names="Times New Roman" Font-Size="Small" CellPadding="6"
ForeColor="#333333" GridLines="None" Width="1303px" Style="text-align: center">
<AlternatingRowStyle BackColor="White" />
<Columns>
<asp:TemplateField HeaderText="Select One">
<ItemTemplate>
<asp:CheckBox ID="myCheckBox" AutoPostBack="true" runat="server" OnCheckedChanged="myCheckBox_CheckedChanged" CausesValidation="true" />
<%--<asp:RadioButton ID="rbtnSelect" AutoPostBack="true" runat="server" OnCheckedChanged="rbtnSelect_CheckedChanged" CausesValidation="true" />--%>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="CD_Competency" HeaderText="Competency Details" ReadOnly="true" SortExpression="Competency" />
<asp:TemplateField HeaderText="Self">
<ItemTemplate>
<asp:DropDownList ID="ddlss" runat="server" DataTextField="selfscore" DataValueField="selfscore" >
<asp:ListItem>0</asp:ListItem>
<asp:ListItem>1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
<asp:ListItem>4</asp:ListItem>
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Supervisor">
<ItemTemplate>
<asp:DropDownList ID="ddlsus" runat="server" DataTextField="supervisiorscore" DataValueField="supervisiorscore">
<asp:ListItem>0</asp:ListItem>
<asp:ListItem>1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem>
<asp:ListItem>4</asp:ListItem>
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Current">
<ItemTemplate>
<asp:Label ID="lblCS" runat="server">
</asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Target">
<ItemTemplate>
<asp:Label ID="lblTS" runat="server">
</asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Development Needs">
<ItemTemplate>
<asp:DropDownList ID="ddlDn" runat="server" DataTextField="D_DevelopmentNeed" DataValueField="D_DevelopmentNeed">
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="" HeaderText="Competency Classification" ReadOnly="true" SortExpression="Competency Classification" />
<asp:TemplateField HeaderText="Remarks">
<ItemTemplate>
<asp:TextBox ID="TextBox1" runat="server"> </asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
<%-- <asp:TemplateField HeaderText="Competency Classification">
<ItemTemplate>
<asp:DropDownList ID="ddlcc" runat="server" DataTextField="CompetencyClassification" DataValueField="CompetencyClassification">
<asp:ListItem>Core</asp:ListItem>
<asp:ListItem>Foundation</asp:ListItem>
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>--%>
</Columns>
<EditRowStyle BackColor="#7C6F57" HorizontalAlign="Left" VerticalAlign="Middle" />
<FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />
<RowStyle BackColor="#E3EAEB" />
<SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />
<SortedAscendingCellStyle BackColor="#F8FAFA" />
<SortedAscendingHeaderStyle BackColor="#246B61" />
<SortedDescendingCellStyle BackColor="#D4DFE1" />
<SortedDescendingHeaderStyle BackColor="#15524A" />
</asp:GridView>
thanks
Pradeep