Link to home
Create AccountLog in
Avatar of pratikshahse
pratikshahse

asked on

Dropdown in gridview ASP.NET,VB.NET

I have a gridview in one of my aspx pages in which I want one column to be dropdown and one other to be a check box and rest to be text boxes. So when the gridview loads all the columns are read only but when the user hits edit button first column needs to be a dropdown with the the values in it being populated from a table in the database. second column needs to be checkbox. rest as textboxes.

Here is how I have created my gridview in the aspx.
<asp:GridView ID="GridView1" AutoGenerateColumns="true" AllowPaging="true" AllowSorting="true"  
            onrowdeleting="GridView1_RowDeleting" onrowediting="GridView1_RowEditing"
                runat="server" AutoGenerateDeleteButton="True" AutoGenerateEditButton="True"
                Width="317px">
                <PagerSettings Position="Top" Mode="NumericFirstLast" />
                <PagerStyle HorizontalAlign="Right" VerticalAlign="Middle" BackColor="#ECF0FC" />
                <FooterStyle BackColor="#CCCCCC" />
                <HeaderStyle BackColor="#284E98" ForeColor="White" Font-Bold="True" />
                <EditRowStyle Wrap="False" />
                <AlternatingRowStyle BackColor="#F6F1D4" BorderColor="Black" />
            </asp:GridView>


Code Behind to populate the gridview:
 Dim cmdList As DbCommand = m_database.GetStoredProcCommand("storeproc_name")

Dim listDS As DataSet = m_database.ExecuteDataSet(cmdList)
            Dim iNoOfRowsReturend As Integer = listDS.Tables(0).Rows.Count
            ShowSearchMessage(iNoOfRowsReturend)

            GridView1.DataSource = listDS
            GridView1.DataBind()



Can someone please help me with this.

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Kyle Abrahams, PMP
Kyle Abrahams, PMP
Flag of United States of America image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer