Hello ,
I'm currently testing Telerik RadGrid control by creating a wrapper class.I’m facing an issue for auto genration of columns in RadGridView with coustom prefix tag .
Here are the steps ,what I have done for testing the control.
1.Have created wrapper of all grid related classes such as RadGrid,RadGridDesigner,20 classes under <columns> and two classes of DetailTables with Prefix "HC" .
2. Have used the <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> in page directive of aspx page.
3.Drag the HCGridView control from the ToolBox and drop inside the aspx page.
4.Below codes are auto generating when I assign the XmlDatasource to HCGridView .
<HC:HCGridView ID="HCGridView1" runat="server"
DataSourceID="XmlDataSourceCulture" GridLines="None" HelpId=""
SecurityApplied="False">
<MasterTableView AutoGenerateColumns="False"
DataSourceID="XmlDataSourceCulture" HelpId="">
<RowIndicatorColumn>
<HeaderStyle Width="20px" />
</RowIndicatorColumn>
<ExpandCollapseColumn>
<HeaderStyle Width="20px" />
</ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn DataField="id" HeaderText="id" SortExpression="id"
UniqueName="id">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="name" HeaderText="name"
SortExpression="name" UniqueName="name">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="value" HeaderText="value"
SortExpression="value" UniqueName="value">
</telerik:GridBoundColumn>
</Columns>
<EditFormSettings>
<EditColumn UniqueName="EditCommandColumn1">
</EditColumn>
</EditFormSettings>
</MasterTableView>
<ClientSettings>
<Selecting AllowRowSelect="True" />
</ClientSettings>
</HC:HCGridView>
Here issue is that ,it is generating the columns under <Columns></Columns> block with the tag “ telerik” instead of “HC” .
Below error is coming in case of remove <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> from page directive of aspx page.
HCGridView - HCGridView1System.Web.HttpParseException: Telerik.Web.UI.GridColumnCollection must have items of type 'Telerik.Web.UI.GridColumn'. 'telerik.web.ui.gridboundcolumn' is of type 'System.Web.UI.HtmlControls.HtmlGenericControl'. ---> System.Web.HttpParseException: Telerik.Web.UI.GridColumnCollection must have items of type 'Telerik.Web.UI.GridColumn'. 'telerik.web.ui.gridboundcolumn' is of type 'System.Web.UI.HtmlControls.HtmlGenericControl'. ---> System.Web.HttpException: Telerik.Web.UI.GridColumnCollection must have items of type 'Telerik.Web.UI.GridColumn'. 'telerik.web.ui.gridboundcolumn' is of type 'System.Web.UI.HtmlControls.HtmlGenericControl'. at System.Web.UI.CollectionBuilder.GetChildControlType(String tagName, IDictionary attribs) at System.Web.UI.ControlBuilder.CreateChildBuilder(String filter, String tagName, IDictionary attribs, TemplateParser parser, ControlBuilder parentBuilder, String id, Int32 line, VirtualPath virtualPath, Type& childType, Boolean defaultProperty) at System.Web.UI.TemplateParser.ProcessBeginTag(Match match, String inputText) at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding) --- End of inner exception stack trace --- at System.Web.UI.TemplateParser.ProcessException(Exception ex) at System.Web.UI.TemplateParser.ParseStringInternal(String text, Encoding fileEncoding) at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding) --- End of inner exception stack trace --- at System.Web.UI.TemplateParser.ParseString(String text, VirtualPath virtualPath, Encoding fileEncoding) at System.Web.UI.TemplateParser.ParseInternal() at System.Web.UI.TemplateParser.Parse() at System.Web.UI.DesignTimeTemplateParser.ParseControlsInternal(DesignTimeParseData data, Boolean returnFirst) at System.Web.UI.DesignTimeTemplateParser.ParseControl(DesignTimeParseData data) at System.Web.UI.Design.ControlSerializer.DeserializeControlInternal(String text, IDesignerHost host, Boolean applyTheme) at System.Web.UI.Design.ControlParser.ParseControl(IDesignerHost designerHost, String controlText, Boolean applyTheme) at System.Web.UI.Design.ControlDesigner.CreateClonedControl(IDesignerHost parseTimeDesignerHost, Boolean applyTheme) at System.Web.UI.Design.ControlDesigner.CreateViewControl() at System.Web.UI.Design.ControlDesigner.CreateViewControlInternal() at System.Web.UI.Design.ControlDesigner.get_ViewControl() at Telerik.Web.Design.RadGridDesigner.get_Grid() at Telerik.Web.Design.RadGridDesigner.GetDesignTimeHtml(DesignerRegionCollection regions) at System.Web.UI.Design.ControlDesigner.GetViewRendering(ControlDesigner designer)
How to Auto Generate Columns of all tags with “HC”
Thanks
-Satya