This is a migrated thread and some comments may be shown as answers.

Data grid multiple row edit

1 Answer 106 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Reeja
Top achievements
Rank 1
Reeja asked on 03 Jul 2008, 01:13 PM
I have a datagrid . In two colums of it, I have a  label in ItemTemplate Tag, and a dropdownlist in EditItemTemplate tag. Editing is enabled in the grid.

Is it possible for me to check different rows of the grid at a time and open all the checked rows in edit mode at the same time?

Now what I do is to store the row index of all checked rows in an array and loop through that array to get the edit index for the grid, but it doesnt work.

Can someone help me with this?

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 05 Jul 2008, 06:49 AM
Hi Reeja,

Try using a GridTemplateColumn with a CheckBox in its ItemTemplate and try the following code snippet in the PreRender event to put the checked rows in edit mode.

ASPX:
                  <Columns> 
                    
                    <telerik:GridTemplateColumn UniqueName="ProductName" HeaderText="ProductName" DataField="ProductName" > 
                     <ItemTemplate> 
                         <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> 
                     </ItemTemplate> 
                     <EditItemTemplate> 
                         <asp:DropDownList ID="DropDownList1" runat="server"
                         </asp:DropDownList> 
                     </EditItemTemplate> 
                    </telerik:GridTemplateColumn> 
                    <telerik:GridTemplateColumn></telerik:GridTemplateColumn> 
                    <telerik:GridTemplateColumn UniqueName="TempCol" HeaderText="TempCol" > 
                     <ItemTemplate> 
                         <asp:CheckBox ID="CheckBox1" AutoPostBack="true" runat="server" /> 
                     </ItemTemplate> 
                    </telerik:GridTemplateColumn> 
                </Columns> 


CS:
 protected void RadGrid1_PreRender(object sender, EventArgs e) 
    { 
        foreach (GridDataItem item in RadGrid1.MasterTableView.Items) 
        { 
            CheckBox chkbx = (CheckBox)item["TempCol"].FindControl("CheckBox1"); 
            if (chkbx.Checked) 
            { 
 
                item.Edit = true
            } 
        } 
        RadGrid1.Rebind(); 
   } 


Thanks
Shinu.
Tags
Grid
Asked by
Reeja
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or