We are modifying the RAD grid for Sharepoint and are running into a problem. We need to change the default filter text box to a drop down combo box for some of the columns like you see in the demo: http://demos.telerik.com/aspnet-ajax/grid/examples/overview/defaultcs.aspx
With the SharePoint control, you have to set the filter template in the GridFilteringItem class. However, when we add the code below, the button is showing but the grid does not refresh and filter based on the combo box selection. The filters for the other columns are working fine. It appears that the event to filter the grid is not firing, but it is difficult to tell.
Does anyone have simple sample code or ideas that would help?
if (e.Item is GridFilteringItem)
{
GridFilteringItem aSystemFilteringItem = e.Item as GridFilteringItem;
//((Telerik.Web.UI.GridTableCell)(aSystemFilteringItem["System"])).Controls.Clear();
Button btnTest = new Button();
btnTest.Text ="CLick Me";
btnTest.Click += btnTest_Click;
((Telerik.Web.UI.GridTableCell)(aSystemFilteringItem["System"])).Controls.Add(btnTest);
RadComboBox aSystemFilterDropDown = new RadComboBox();
aSystemFilterDropDown.ID = "ProcessFilterDropDown";
aSystemFilterDropDown.Width = Unit.Pixel(150);
aSystemFilterDropDown.Items.Add(new RadComboBoxItem("", ""));
aSystemFilterDropDown.Items.Add(new RadComboBoxItem("CGE", "CGE"));
//aSystemFilterDropDown.SelectedIndexChanged += aSystemFilterDropDown_SelectedIndexChanged;
aSystemFilterDropDown.OnClientSelectedIndexChanged = "SystemIndexChanged";
aSystemFilterDropDown.AutoPostBack = true;
((Telerik.Web.UI.GridTableCell)(aSystemFilteringItem["System"])).Controls.Add(aSystemFilterDropDown);
string script = "<script type=\"text/javascript\">";
script = script + "function SystemIndexChanged(sender, args) {alert('entered'); ";
script = script + "var tableView = $find(\"" + ((GridItem)e.Item).OwnerTableView.ClientID + "\");";
script = script + "tableView.filter(\"System\", args.get_item().get_value(), \"EqualTo\");";
script = script+ "}";
script = script + "</script>";
LiteralControl scriptLtControl = new LiteralControl(script);
RadScriptBlock radscript = new RadScriptBlock();
radscript.Controls.Clear();
radscript.Controls.Add(scriptLtControl);
((Telerik.Web.UI.GridTableCell)(aSystemFilteringItem["System"])).Controls.Add(radscript);
}
With the SharePoint control, you have to set the filter template in the GridFilteringItem class. However, when we add the code below, the button is showing but the grid does not refresh and filter based on the combo box selection. The filters for the other columns are working fine. It appears that the event to filter the grid is not firing, but it is difficult to tell.
Does anyone have simple sample code or ideas that would help?
if (e.Item is GridFilteringItem)
{
GridFilteringItem aSystemFilteringItem = e.Item as GridFilteringItem;
//((Telerik.Web.UI.GridTableCell)(aSystemFilteringItem["System"])).Controls.Clear();
Button btnTest = new Button();
btnTest.Text ="CLick Me";
btnTest.Click += btnTest_Click;
((Telerik.Web.UI.GridTableCell)(aSystemFilteringItem["System"])).Controls.Add(btnTest);
RadComboBox aSystemFilterDropDown = new RadComboBox();
aSystemFilterDropDown.ID = "ProcessFilterDropDown";
aSystemFilterDropDown.Width = Unit.Pixel(150);
aSystemFilterDropDown.Items.Add(new RadComboBoxItem("", ""));
aSystemFilterDropDown.Items.Add(new RadComboBoxItem("CGE", "CGE"));
//aSystemFilterDropDown.SelectedIndexChanged += aSystemFilterDropDown_SelectedIndexChanged;
aSystemFilterDropDown.OnClientSelectedIndexChanged = "SystemIndexChanged";
aSystemFilterDropDown.AutoPostBack = true;
((Telerik.Web.UI.GridTableCell)(aSystemFilteringItem["System"])).Controls.Add(aSystemFilterDropDown);
string script = "<script type=\"text/javascript\">";
script = script + "function SystemIndexChanged(sender, args) {alert('entered'); ";
script = script + "var tableView = $find(\"" + ((GridItem)e.Item).OwnerTableView.ClientID + "\");";
script = script + "tableView.filter(\"System\", args.get_item().get_value(), \"EqualTo\");";
script = script+ "}";
script = script + "</script>";
LiteralControl scriptLtControl = new LiteralControl(script);
RadScriptBlock radscript = new RadScriptBlock();
radscript.Controls.Clear();
radscript.Controls.Add(scriptLtControl);
((Telerik.Web.UI.GridTableCell)(aSystemFilteringItem["System"])).Controls.Add(radscript);
}