Hi,
I have been trying to extend the Telerik GridBoundColumn. Everything seems to be OK when it is used in the statdarnd RadGrid without Filtering.
When I turn on the AllowFilteringByColumn property of the RadGrid, I get the following error message:
And these are my code:
New GridBoundColumn
Aspx:
Codebehide:
Is there anyone can help me to solve this problems? Thanks
I have been trying to extend the Telerik GridBoundColumn. Everything seems to be OK when it is used in the statdarnd RadGrid without Filtering.
When I turn on the AllowFilteringByColumn property of the RadGrid, I get the following error message:
| Multiple controls with the same ID 'FilterTextBox_Date' were found. FindControl requires that controls have unique IDs. |
| Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. |
| Exception Details: System.Web.HttpException: Multiple controls with the same ID 'FilterTextBox_Date' were found. FindControl requires that controls have unique IDs. |
| Source Error: |
| An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. |
| Stack Trace: |
| [HttpException (0x80004005): Multiple controls with the same ID 'FilterTextBox_Date' were found. FindControl requires that controls have unique IDs.] |
| System.Web.UI.Control.FillNamedControlsTable(Control namingContainer, ControlCollection controls) +273 |
| System.Web.UI.Control.FillNamedControlsTable(Control namingContainer, ControlCollection controls) +320 |
| System.Web.UI.Control.EnsureNamedControlsTable() +61 |
| System.Web.UI.Control.FindControl(String id, Int32 pathOffset) +222 |
| System.Web.UI.Control.FindControl(String id) +12 |
| Telerik.Web.UI.GridColumn.PrepareCell(TableCell cell, GridItem item) +1238 |
| Telerik.Web.UI.GridItemDecorator.DecorateItem(GridTableView owner, GridColumn[] columnArray) +364 |
| Telerik.Web.UI.GridFilterItemDecorator.DecorateItem(GridTableView owner, GridColumn[] columnArray) +112 |
| Telerik.Web.UI.GridItem.PrepareItemStyle() +259 |
| Telerik.Web.UI.GridMultiRowItem.PrepareItemStyle() +109 |
| Telerik.Web.UI.RadGrid.PrepareRows(GridTableView view) +132 |
| Telerik.Web.UI.RadGrid.Render(HtmlTextWriter writer) +92 |
| System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27 |
| System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99 |
| System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25 |
| System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134 |
| System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19 |
| System.Web.UI.HtmlControls.HtmlForm.RenderChildren(HtmlTextWriter writer) +163 |
| System.Web.UI.HtmlControls.HtmlContainerControl.Render(HtmlTextWriter writer) +32 |
| System.Web.UI.HtmlControls.HtmlForm.Render(HtmlTextWriter output) +51 |
| System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27 |
| System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99 |
| System.Web.UI.HtmlControls.HtmlForm.RenderControl(HtmlTextWriter writer) +40 |
| System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) +134 |
| System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +19 |
| System.Web.UI.Page.Render(HtmlTextWriter writer) +29 |
| System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) +27 |
| System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) +99 |
| System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +25 |
| System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1266 |
And these are my code:
New GridBoundColumn
| public class MyGridBoundColumn : GridBoundColumn |
| { |
| } |
Aspx:
| <telerik:DDSGrid ID="uxGrid" runat="server" GridLines="None" Width="100%" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" AllowFilteringByColumn="true" |
| OnNeedDataSource="uxGrid_NeedDataSource" EnableEmbeddedSkins="false"> |
| <MasterTableView > |
| <Columns> |
| <me:MyGridBoundColumn HeaderStyle-HorizontalAlign="Center" UniqueName="Row" HeaderText="Row" DataField="Row"/> |
| </Columns> |
| </MasterTableView> |
| </telerik:DDSGrid> |
Codebehide:
| protected void uxGrid_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e) |
| { |
| DataTable tb = new DataTable("tb"); |
| DataColumn col; |
| DataRow row; |
| col = new DataColumn("Row"); |
| tb.Columns.Add(col); |
| for (int i = 1; i <= 1; i++) |
| { |
| row = tb.NewRow(); |
| row["Row"] = "Row " + i; |
| tb.Rows.Add(row); |
| } |
| ((RadGrid)source).DataSource = tb; |
| } |
Is there anyone can help me to solve this problems? Thanks