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

OnNeedDataSource and OnFilterCheckListItemsRequested in C#

1 Answer 224 Views
Filter
This is a migrated thread and some comments may be shown as answers.
Sebastiaan
Top achievements
Rank 1
Sebastiaan asked on 26 Jan 2016, 03:07 PM

Hello,

 

I would like to set OnNeedDataSource and OnFilterCheckListItemsRequested in C# and not in aspx.

 

When having this line in Default.aspx it all works fine:

<telerik:RadGrid ID="RadGrid2" runat="server" Width="750px" OnNeedDataSource="RadGrid2_NeedDataSource"
        OnFilterCheckListItemsRequested="RadGrid2_FilterCheckListItemsRequested">

 

But I would like to get everything but ID and runat to Default.aspx.cs.

Like so:

RadGrid2.MasterTableView.DataKeyNames = new string[] { "ID" };
RadGrid2.AllowPaging = true;
RadGrid2.AllowSorting = true;
RadGrid2.GroupingEnabled = true;
RadGrid2.GroupPanelPosition = GridGroupPanelPosition.Top;
RadGrid2.AllowFilteringByColumn = true;
RadGrid2.FilterType = GridFilterType.HeaderContext;
RadGrid2.EnableHeaderContextMenu = true;
RadGrid2.EnableHeaderContextFilterMenu = true;

 

But when adding these:

RadGrid2.OnNeedDataSource
RadGrid2.OnFilterCheckListItemsRequested

I get an error saying these are inaccessible due to their protection level.

So how can I assign RadGrid2_NeedDataSource and RadGrid2_FilterCheckListItemsRequested in C#?

1 Answer, 1 is accepted

Sort by
0
Viktor Tachev
Telerik team
answered on 28 Jan 2016, 01:09 PM
Hi Sebastiaan,

In order to specify the settings for RadGrid you can use the Page_Load event. Check out the following article that describes the approach in more details.


In addition I am attaching a sample project where the behavior is implemented. Give it a try and see how it works for you.

Regards,
Viktor Tachev
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
Tags
Filter
Asked by
Sebastiaan
Top achievements
Rank 1
Answers by
Viktor Tachev
Telerik team
Share this question
or