Hi,
I currently have a couple of RadDatePickers in a GridBoundColumn's FilterTemplate section. I'm using the ClientEvents-OnDateSelected on both RadDatePickers to call a JavaScript function.
In the JavaScript event that's called by the RadDatePickers I need the name of the column that the RadDatePicker which called the event is in. Any idea how I can get this?
Cheers,
Adam
I currently have a couple of RadDatePickers in a GridBoundColumn's FilterTemplate section. I'm using the ClientEvents-OnDateSelected on both RadDatePickers to call a JavaScript function.
ClientEvents-OnDateSelected="DateSelected"
function DateSelected(sender, args) {
...
}
In the JavaScript event that's called by the RadDatePickers I need the name of the column that the RadDatePicker which called the event is in. Any idea how I can get this?
Cheers,
Adam
5 Answers, 1 is accepted
0

Adam
Top achievements
Rank 1
answered on 07 Jun 2011, 11:35 AM
In my example I am extending the GridBoundColumn class and the following solution works for me:
I added a custom attribute to the RadDatePickers called "ParentColumName".
I pick this up in the JS event as follows:
I can then use the column name to fire off this particular column's filters etc.
Adam
I added a custom attribute to the RadDatePickers called "ParentColumName".
fromDatePicker.Attributes.Add( "ParentColumnName", this.UniqueName );
I pick this up in the JS event as follows:
var parentColumnName = sender.get_element().parentNode.getAttribute('ParentColumnName');
I can then use the column name to fire off this particular column's filters etc.
Adam
0

Rajan
Top achievements
Rank 1
answered on 18 Sep 2015, 10:57 AM
Is there any in-built solution by Telerik?
0

Adam
Top achievements
Rank 1
answered on 18 Sep 2015, 11:24 AM
No idea, dude. This solution worked for me so I stuck with it.
0
Hello Rajan,
Since this is a control within a template (the FilterTemplate), RadGrid could not have any control over the content of that template, which is the reason that there could not be a built-in way for retrieving the column name from within a client-side event of the filter control. However, the approach that Adam is using is simple enough and should help you achieve the desired result.
Best Regards,
Konstantin Dikov
Telerik
Since this is a control within a template (the FilterTemplate), RadGrid could not have any control over the content of that template, which is the reason that there could not be a built-in way for retrieving the column name from within a client-side event of the filter control. However, the approach that Adam is using is simple enough and should help you achieve the desired result.
Best Regards,
Konstantin Dikov
Telerik
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 Feedback Portal
and vote to affect the priority of the items
0

Rajan
Top achievements
Rank 1
answered on 23 Sep 2015, 05:09 PM
Thanks Konstantin. Adams post helped me. However I was just curious to know if there is alternate solution.