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

[Solved] Add control GridGroupHeaderItem client side

5 Answers 108 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bryan Strader
Top achievements
Rank 2
Bryan Strader asked on 02 Feb 2010, 09:43 PM
I am trying to add a checkbox to the group headings in my RadGrid, and I followed the instructions in a forum to do this server side. The problem I am having is similar to what the users are describing here:



I need to add the checkbox, but seems I can only get it to work when I have the grid GroupLoadMode set to Server. The issue I have is

 that I specifically need this set to client for other functionality I have already coded. Does somebody have an example of adding a

 checkbox or other control to a group heading using javascript (Client-side) as opposed to some of the other examples on this website

 that accomplish the same thing using server side code?

5 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 05 Feb 2010, 02:07 PM
Hi Bryan,

To achieve your goal you could handle onload client side event of GridGroupHeaderItem and add a checkbox. Please give this suggestion a try and see if it works for you.

Best wishes,
Pavlina
the Telerik team

Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Follow the status of features or bugs in PITS and vote for them to affect their priority.
0
Bryan Strader
Top achievements
Rank 2
answered on 09 Feb 2010, 05:54 PM
Hi Pavlina - Thank you for the response. That sounds like what I am trying to do, except I have a few more questions. Where do I enable the GripGroupHeaderItem OnLoad event? Is that part of the GridGroupByExpression in the markup? Is there anyway you can provide a real basic example of this javascript? Thanks again for your help!

Bryan
0
Pavlina
Telerik team
answered on 12 Feb 2010, 01:05 PM
Hello Bryan,

Could you please send us the code you currently use to achieve the desired functionality? Thus we can test it locally and advise you further.

All the best,
Pavlina
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Bryan Strader
Top achievements
Rank 2
answered on 12 Feb 2010, 04:19 PM

For grid events OnItemCreated (server-side), and ItemDataBound (server-side), I am calling the following method:

 

 

private void CreateHeaderControls(GridItemEventArgs e)

 

{

 

if (e.Item is GridGroupHeaderItem)

 

{

 

GridGroupHeaderItem item = e.Item as GridGroupHeaderItem;

 

 

DataRowView groupDataRow = (DataRowView)e.Item.DataItem;

 

 

CheckBox check = new CheckBox();

 

check.AutoPostBack =

true;

 

check.ID =

"CheckAll";

 

check.Text =

"Select all items in group ";

 

check.CheckedChanged +=

new EventHandler(check_CheckedChanged);

 

check.Visible =

true;

 

check.ToolTip =

"Select all in this group ";

 

item.DataCell.Controls.Add(check);

item.DataCell.Visible =

true;

 

}

}



The problem seems to be that my grid settings in the Mark-up contain: grouploadmode="Client"

I need this to stay client because I am using some other javascript to expand/collapse the groups in the grid, which works perfectly fine. If I change GroupLoadMode="Server", the server-side code listed above generates the checkboxes, but only after the first rebind.

What I would like to accomplish, is the same functionality listed above in the CreateHeaderControls method but using some client-side scripting. Is there any example that would show me how to accomplish this?

Thanks!

 

 

 

 

 

 


 

0
Pavlina
Telerik team
answered on 17 Feb 2010, 04:56 PM
Hi Bryan,

You can use RadGrid client-side API to accomplish this
Getting RadGrid client object and related topics.

Kind regards,
Pavlina
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Grid
Asked by
Bryan Strader
Top achievements
Rank 2
Answers by
Pavlina
Telerik team
Bryan Strader
Top achievements
Rank 2
Share this question
or