Editable datagridview
-
Hello I need help in editing a datagridview's row. I have a grid which is dynamically populated in a way that user adds some data in the form of rows. Now, I want to give the user the option to edit the row as well. I want to provide the functionality just like asp.net's editable gridview. that is, i want that when a user click on a cell to edit it, a dropdown should be displayed containing selected values. I also want that user may have a cell with text 'edit' and user should click that to start editing the row. as soon as the user click the 'edit', the text should be changed to 'update'. Please guide me for it.
saq!b "Our scientific power has outrun our spiritual power. We have guided missiles and misguided men." Dr. Martin Luther King Jr.
-
Hello I need help in editing a datagridview's row. I have a grid which is dynamically populated in a way that user adds some data in the form of rows. Now, I want to give the user the option to edit the row as well. I want to provide the functionality just like asp.net's editable gridview. that is, i want that when a user click on a cell to edit it, a dropdown should be displayed containing selected values. I also want that user may have a cell with text 'edit' and user should click that to start editing the row. as soon as the user click the 'edit', the text should be changed to 'update'. Please guide me for it.
saq!b "Our scientific power has outrun our spiritual power. We have guided missiles and misguided men." Dr. Martin Luther King Jr.
-
Look into
DataGridViewComboBoxColumn
andDataGridViewButton
column. That must suite your needs. :)thanks danish. i was just looking into DataGridViewComboBoxColumn. please tell me if it is possible to change the column type of a row at runtime?
saq!b "Our scientific power has outrun our spiritual power. We have guided missiles and misguided men." Dr. Martin Luther King Jr.
-
thanks danish. i was just looking into DataGridViewComboBoxColumn. please tell me if it is possible to change the column type of a row at runtime?
saq!b "Our scientific power has outrun our spiritual power. We have guided missiles and misguided men." Dr. Martin Luther King Jr.
-
Hello I need help in editing a datagridview's row. I have a grid which is dynamically populated in a way that user adds some data in the form of rows. Now, I want to give the user the option to edit the row as well. I want to provide the functionality just like asp.net's editable gridview. that is, i want that when a user click on a cell to edit it, a dropdown should be displayed containing selected values. I also want that user may have a cell with text 'edit' and user should click that to start editing the row. as soon as the user click the 'edit', the text should be changed to 'update'. Please guide me for it.
saq!b "Our scientific power has outrun our spiritual power. We have guided missiles and misguided men." Dr. Martin Luther King Jr.
Hi, Go through this code........ <asp:GridView ID="gv" runat="server" AutoGenerateColumns="False" BackColor="#CCCCCC" BorderColor="#999999" BorderStyle="Solid" BorderWidth="3px" CellPadding="4" CellSpacing="2" ForeColor="Black" Height="285px" onrowcancelingedit="gv_RowCancelingEdit" onrowdeleting="gv_RowDeleting" onrowediting="gv_RowEditing" onrowupdating="gv_RowUpdating" Width="493px"> <FooterStyle BackColor="#CCCCCC" /> <RowStyle BackColor="White" /> <Columns> <asp:BoundField DataField="Name" HeaderText="Item Name" /> asp:TemplateField <HeaderTemplate> <asp:Label ID="lblHead" runat="server" Text="Price"></asp:Label> </HeaderTemplate> <ItemTemplate> <asp:Label ID="lblPrice" runat="server" Text='<%#Eval("Price")%>'></asp:Label> </ItemTemplate> <EditItemTemplate> <asp:DropDownList ID="ddl1" runat="server"> asp:ListItem1000</asp:ListItem> asp:ListItem2000</asp:ListItem> asp:ListItem3000</asp:ListItem> asp:ListItem4000</asp:ListItem> </asp:DropDownList> </EditItemTemplate> </asp:TemplateField> <asp:ButtonField DataTextField="Description" HeaderText="Desription" /> <asp:CommandField ShowCancelButton="true" ShowDeleteButton="true" ShowEditButton="true" /> </Columns> <PagerStyle BackColor="#CCCCCC" ForeColor="Black" HorizontalAlign="Left" /> <SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" /> <HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" /> </asp:GridView>