I was trying to create a User Control for standardizing the Grid Control across all the forms. Surely all the forms will have different columns but the layout is the same across except for few properties here and there. How do I expose the Column Collection?
My Code would be:
<telerik:RadGrid ID="grid" runat="server" AllowCustomPaging="false" AllowPaging="False" AllowSorting="False" AutoGenerateColumns="False" CellPadding="0" CellSpacing="0" CssClass="gridCandidate" Height="100%" Width="100%">
<ClientSettings EnableAlternatingItems="false" EnableRowHoverStyle="true"> <Scrolling AllowScroll="true" UseStaticHeaders="true" /> <Selecting AllowRowSelect="True" /> <ClientEvents OnRowDataBound="function() {}" OnCommand="function(){}" /> </ClientSettings> <MasterTableView AllowFilteringByColumn="False" AllowNaturalSort="false" ClientDataKeyNames="ID" DataKeyNames="ID" EnableColumnsViewState="False" EnableViewState="False" HierarchyLoadMode="Client" NoMasterRecordsText="<div class='noRec'>No records to display.</div>" TableLayout="Auto"> <Columns></Columns><HeaderStyle Height="0px" /> <PagerStyle Visible="False" /> </MasterTableView> </telerik:RadGrid>
[MergableProperty(false), DefaultValue((string)null),
PersistenceMode(PersistenceMode.InnerProperty)]
public GridColumnCollection Columns{ get { return grid.Columns; } set { foreach (GridColumn column in value) { grid.MasterTableView.Columns.Add(column); } //grid.MasterTableView.Columns.Add() }}
Any idea how to expose the Columns property?