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

Selecting all rows programmatic server or javascript during the PageLoad?

3 Answers 51 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bruno
Top achievements
Rank 1
Bruno asked on 02 Mar 2009, 02:41 PM
Hello

I Have one RadGrid where I want to update a status flag, everithing is working fine but I need that all rows starts selected to prevent the user to click on the "select all" checkbox.

how can I do to programmatic or some Jscript to select all itens during pageload, or to select each item during databinding?


I Imagine somethng like:

RadGrid1.Checkboxes.attr("selected","true")
or

foreach (item in RadGrid1.Itens){
this.selected = "true";
}

Thanxs

3 Answers, 1 is accepted

Sort by
0
Bruno
Top achievements
Rank 1
answered on 02 Mar 2009, 02:56 PM
I tried that

protected void Page_Load(object sender, EventArgs e) 
        { 
            foreach (int Item in RadGrid1.Items)  
            { 
                RadGrid1.Items[Item].Selected = true
            }  
        } 

But it isnt work in page_load...


0
Accepted
Daniel
Telerik team
answered on 02 Mar 2009, 03:12 PM
Hello Bruno,

Test the following snippet:
protected void RadGrid1_PreRender(object sender, EventArgs e) 
    foreach (GridDataItem item in RadGrid1.Items) 
       item.Selected = true

Regards,
Daniel
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Bruno
Top achievements
Rank 1
answered on 02 Mar 2009, 03:19 PM
Perfect!

I Just include that

OnPreRender="RadGrid1_PreRender" 

Thank you!
Tags
Grid
Asked by
Bruno
Top achievements
Rank 1
Answers by
Bruno
Top achievements
Rank 1
Daniel
Telerik team
Share this question
or