
It would be posible a example?
Thank you in advance.
12 Answers, 1 is accepted
Please find attached a sample project which I prepared, following the project provided in the example you mentioned.
I added the RadGrid in a UserControl and it works as expected.
Please test the application on your side and let us know if it works for you.
Kind regards,
Maria Ilieva
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.

Thaks, but my proble is that i use a load dynamic for the webusercontrol, i use this "loaderControl", then, in your example, you use the page_load event to configure the "googleColumns" and only load the customcolumns in the first call of the page :
If
Not IsPostBack Then
ds = GetDataSet(
"SELECT Country, City, Index FROM Customers")
Me.RadGrid1.MasterTableView.Columns.Clear()
For Each dataColumn As DataColumn In ds.Tables(0).Columns
Dim gridColumn As RadGrid.MyCustomFilteringColumn = New RadGrid.MyCustomFilteringColumn
Me.RadGrid1.MasterTableView.Columns.Add(gridColumn)
gridColumn.DataField = dataColumn.ColumnName
gridColumn.HeaderText = dataColumn.ColumnName
Next
End If
but, i need to know how and when i can configure the columns because in my case, i can't do it in the page load event.
loadercontrol.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
<html xmlns="http://www.w3.org/1999/xhtml"> |
<head runat="server"> |
<title>Untitled Page</title> |
</head> |
<body> |
<form id="form1" runat="server"> |
<asp:ScriptManager ID="ScriptManager1" runat="server" /> |
<div> |
<table> |
<tr> |
<td> |
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" /> |
</td> |
<td> |
<asp:Panel ID="Panel1" runat="server"> |
</asp:Panel> |
</td> |
</tr> |
</table> |
</div> |
</form> |
</body> |
</html> |
loadercontrol.aspx.cs:
using System.Web.UI; |
using System.Web.UI.WebControls; |
using System.Web.UI.WebControls.WebParts; |
using System.Web.UI.HtmlControls; |
public partial class _Default : System.Web.UI.Page |
{ |
protected void Page_Load(object sender, EventArgs e) |
{ |
if (LatestLoadedControlName != null) |
{ |
LoadUserControl(LatestLoadedControlName); |
} |
} |
protected void Button1_Click(object sender, EventArgs e) |
{ |
this.LoadUserControl("WebUserControl.ascx"); |
} |
private string LatestLoadedControlName |
{ |
get |
{ |
return (string)ViewState["LatestLoadedControlName"]; |
} |
set |
{ |
ViewState["LatestLoadedControlName"] = value; |
} |
} |
public void LoadUserControl(string controlName) |
{ |
if (LatestLoadedControlName != null) |
{ |
Control previousControl = Panel1.FindControl(LatestLoadedControlName); |
if (previousControl != null) |
{ |
this.Panel1.Controls.Remove(previousControl); |
} |
} |
string userControlID = controlName; |
Control targetControl = Panel1.FindControl(userControlID); |
if (targetControl == null) |
{ |
UserControl userControl = (UserControl)this.LoadControl(controlName); |
//slashes and tildes are forbidden |
userControl.ID = userControlID.Replace("/", "").Replace("~", ""); |
//this.phMain.Controls.Clear(); |
this.Panel1.Controls.Add(userControl); |
LatestLoadedControlName = controlName; |
} |
} |
} |
TA.

Thaks, but my proble is that i use a load dynamic for the webusercontrol, i use this "loaderControl", then, in your example, you use the page_load event to configure the "googleColumns" and only load the customcolumns in the first call of the page :
If
Not IsPostBack Then
ds = GetDataSet(
"SELECT Country, City, Index FROM Customers")
Me.RadGrid1.MasterTableView.Columns.Clear()
For Each dataColumn As DataColumn In ds.Tables(0).Columns
Dim gridColumn As RadGrid.MyCustomFilteringColumn = New RadGrid.MyCustomFilteringColumn
Me.RadGrid1.MasterTableView.Columns.Add(gridColumn)
gridColumn.DataField = dataColumn.ColumnName
gridColumn.HeaderText = dataColumn.ColumnName
Next
End If
but, i need to know how and when i can configure the columns because in my case, i can't do it in the page load event.
loadercontrol.aspx:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> |
<html xmlns="http://www.w3.org/1999/xhtml"> |
<head runat="server"> |
<title>Untitled Page</title> |
</head> |
<body> |
<form id="form1" runat="server"> |
<asp:ScriptManager ID="ScriptManager1" runat="server" /> |
<div> |
<table> |
<tr> |
<td> |
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" /> |
</td> |
<td> |
<asp:Panel ID="Panel1" runat="server"> |
</asp:Panel> |
</td> |
</tr> |
</table> |
</div> |
</form> |
</body> |
</html> |
loadercontrol.aspx.cs:
using System.Web.UI; |
using System.Web.UI.WebControls; |
using System.Web.UI.WebControls.WebParts; |
using System.Web.UI.HtmlControls; |
public partial class _Default : System.Web.UI.Page |
{ |
protected void Page_Load(object sender, EventArgs e) |
{ |
if (LatestLoadedControlName != null) |
{ |
LoadUserControl(LatestLoadedControlName); |
} |
} |
protected void Button1_Click(object sender, EventArgs e) |
{ |
this.LoadUserControl("WebUserControl.ascx"); |
} |
private string LatestLoadedControlName |
{ |
get |
{ |
return (string)ViewState["LatestLoadedControlName"]; |
} |
set |
{ |
ViewState["LatestLoadedControlName"] = value; |
} |
} |
public void LoadUserControl(string controlName) |
{ |
if (LatestLoadedControlName != null) |
{ |
Control previousControl = Panel1.FindControl(LatestLoadedControlName); |
if (previousControl != null) |
{ |
this.Panel1.Controls.Remove(previousControl); |
} |
} |
string userControlID = controlName; |
Control targetControl = Panel1.FindControl(userControlID); |
if (targetControl == null) |
{ |
UserControl userControl = (UserControl)this.LoadControl(controlName); |
//slashes and tildes are forbidden |
userControl.ID = userControlID.Replace("/", "").Replace("~", ""); |
//this.phMain.Controls.Clear(); |
this.Panel1.Controls.Add(userControl); |
LatestLoadedControlName = controlName; |
} |
} |
} |
TA.
Please review the following help topics which will clarify the requirements needed to acheive your scenario:
RadGrid ProgrammaticCreation
Loading user control with Telerik RadGrid at runtime
All the best,
Maria Ilieva
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.

I am using Telerik Version - 2010.1.309.20 RadGrid control.
Google style filter was working fine with AJAX Extensions 1.0 and we were using asp:scritmanager for AJAX.
we upgraded our application with AJAXControlToolkit-3.5.40412.0 version and changed master page with toolkitscriptmanager.
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %> |
<ajaxToolkit:ToolkitScriptManager ID="masterPageScriptManager" runat="server" AsyncPostBackTimeout="1200" |
EnableScriptGlobalization="true"> |
</ajaxToolkit:ToolkitScriptManager> |
Now We are getting filtering issue. It doesn't populate the filter dropdownlist and keep on displaying Loading.... message.
When I debug the code it was executing correctly without any exception. It was getting data and RadCombobox object and successfuly assigning the datasource and executing the Databind() function.
So can you just help us in finding the cause of this issue. As we have not change anything in code.
Do i miss any configuration part.
I tried to replicate the filtering issue with the ToolkitScriptManager but to no avail. Please find attached a sample application which works as expected on my side. Test it locally and let me know if it works for you.
Greetings,
Maria Ilieva
the Telerik team

Thanks for the quick reply.
Well i was having issue with google style filtering dropdown list.
Now it got resolved.
We added HTTPModule in our web application which alter the response based on some condition. We haven't handle this response for FIlter postback request and it was clearing the resoponse data.
I'm glad that you have managed to fix the problem.
Do not hesitate to contact Telerik Support if further assistance is needed.
Greetings,
Maria Ilieva
the Telerik team

I want to populate filter dropdownlist from Grid Datasource.
I have used onNeedDatasouce event for assigning datasource to RadGrid.
public class MyGridBoundColumn : GridBoundColumn |
{ |
.... |
.... |
.... |
private void list_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e) |
{ |
ObjectDataSource source = (ObjectDataSource).Owner.OwnerGrid.DataSourceObject; |
source.FilterExpression = filter; |
dv = (DataView)source.Select(); |
dv.Sort = this.UniqueName + " ASC"; |
DataTable dt = dv.ToTable(true, new string[] { this.UniqueName }); |
(o as RadComboBox).DataSource = dt; |
(o as RadComboBox).DataTextField = this.DataField; |
(o as RadComboBox).DataValueField = this.DataField; |
(o as RadComboBox).DataBind(); |
} |
} |
Now issue is that needdatasource event doesn't fire when I click on filter textbox. So I am getting null grid datasource on list_ItemsRequested event and thats why dropdown comes empty.
So any solution to fill this filter dropdownlist from RadGrid Datasource.
can we call NeedDatasource event explicitly.
Please refer to the following help topic which elaborates on how to operate with the FilterExpression of RadGrid.
Sincerely yours,
Maria Ilieva
the Telerik team

I read the help topic but still didn't get the solution out of it.
If you want i can send a sample project.
It will be best to open regular support ticket and send us sample runnable application. We will test it locally and advise you further.
All the best,
Maria Ilieva
the Telerik team