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

Problem with GridBoundColumn

6 Answers 159 Views
Grid
This is a migrated thread and some comments may be shown as answers.
$_$
Top achievements
Rank 1
$_$ asked on 17 Nov 2009, 04:00 AM
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:
 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




6 Answers, 1 is accepted

Sort by
0
$_$
Top achievements
Rank 1
answered on 17 Nov 2009, 04:06 AM
One more information is that I am using Telerik version 2008.3.1314.35
0
$_$
Top achievements
Rank 1
answered on 18 Nov 2009, 01:50 AM
Sorry, this is my fault. I have found it. Please, close this thread. Thanks
0
Marc
Top achievements
Rank 1
answered on 11 Aug 2011, 06:16 PM
It would have been great if you could have said what it was that you found to be the cause of your problem.
0
Nishant
Top achievements
Rank 1
answered on 27 Jan 2014, 06:17 AM
Could you tell what was the problem.
I am also facing same issue some time in auto generated column of radgrid. Please tell how can i trace my problem.


Regards,
Nishant
0
Princy
Top achievements
Rank 2
answered on 27 Jan 2014, 06:38 AM
Hi Nishant,

I'm not clear about your issue, I guess you are getting some exception. Seems like you ended up with multiple controls on your form having the same auto-generated ID. Can you check for the controls in the form, and check in its  ID property - there should be some controls that have the same value, you can change it to any unique value, and this should fix the problems. If this doesn't help, please provide your full code snippet.

Thanks,
Princy
0
$_$
Top achievements
Rank 1
answered on 27 Jan 2014, 06:56 AM
Hi Nishant,
I couldn't remember what happened at that time :)
But please remember to override the two methods:
+ protected override void CopyBaseProperties(GridColumn fromColumn)
+ public override GridColumn Clone()
 or else you will get problems later

Regards
Tags
Grid
Asked by
$_$
Top achievements
Rank 1
Answers by
$_$
Top achievements
Rank 1
Marc
Top achievements
Rank 1
Nishant
Top achievements
Rank 1
Princy
Top achievements
Rank 2
Share this question
or