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

Put all rows into edit mode on page load

3 Answers 111 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Mike Eaton
Top achievements
Rank 1
Mike Eaton asked on 29 Sep 2008, 03:43 PM
Hi,

I am trying to convert one of our existing tables into a telerik grid; the table has 5 columns of various types including non editable text, editable text and checkboxes. I need to be able to have every row in edit mode on page load, any changes made will be saved using a save button on the page. I have tried the suggestions in http://www.telerik.com/help/aspnet/grid/grddefaulteditmodeforgriditemsoninitialload.html but can only get the bottom row to go into edit mode.

I also need the checkbox columns to have a "select/deselect" all column, there are multiple checkbox columns so selecting/deselecting should not select or deselect the row, is there a setting that does this?

Many thanks

3 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 30 Sep 2008, 03:52 AM
Hello Mike,

Make sure that you have set the AllowMultiRowEdit property of the grid to true so that all the rows are put into EditMode.I'm not sure of your second requirement, but you can use the GridClientSelectColumn with AllowMultiRowSelection="True" for the grid to select/deselect items, if that is what you require.
    For more information on GridClientSelectColumn you can also go  through this link.

Regards
Princy.
0
Mike Eaton
Top achievements
Rank 1
answered on 30 Sep 2008, 03:03 PM
Hi Princy,

Thanks for your response, I was missing the AllowMultiRowEdit being set to true so I now can get all rows into edit mode.

I had a look at the GridClientSelectColumn as you suggested but this doesnt seem to be what im looking for. I dont want the click of check boxes to select the grid rows; I have 3 check box column which represent 3 admin settings for each row in the grid, i would like the user to be able to click a checkbox in the header row that simply checks or unchecks all the checkboxes in its column, we have been doing this using javascript to find all checkboxes with a similar name but I was wondering if there is a Telerik control that does this in a better way.

Thanks again
0
Shinu
Top achievements
Rank 2
answered on 01 Oct 2008, 04:57 AM
Hi Mike,

I hope you are using  a GridTemplateColumn. If so in the CheckChanged event of the header checkbox access all the checkboxes in that column and check/uncheck accordingly.


ASPX:
 <telerik:GridTemplateColumn UniqueName="TempCol" DataField="TimeSpan"  > 
                      <HeaderTemplate> 
                      <asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="true" OnCheckedChanged="CheckBox1_CheckedChanged" /> 
                         
                      </HeaderTemplate> 
                      <ItemTemplate> 
                            <asp:CheckBox ID="CheckBox2"   runat="server" /> 
                      </ItemTemplate> 
                    </telerik:GridTemplateColumn> 

CS:
 protected void CheckBox1_CheckedChanged(object sender, EventArgs e) 
    { 
        CheckBox headerChkbx = (CheckBox)sender; 
        
        foreach (GridDataItem item in RadGrid1.MasterTableView.Items) 
        { 
            CheckBox chkbx = (CheckBox)item["TempCol"].FindControl("CheckBox2"); 
            chkbx.Checked = headerChkbx.Checked; 
        } 
    } 


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