I am trying to create a Grid dynamically and implementing sorting on that (Grid Getting Disintegratesd on sorting{unwanted empty columns appear}):
Html Code:
<telerik:RadGrid ID="rdGrd" runat="server" AutoGenerateColumns="False" EnableEmbeddedSkins ="false" Skin="Outlook" HeaderStyle-HorizontalAlign="Left" CssClass="RadGrid_Outlook"
GridLines="Both" Height="350px" AllowSorting = "true">
<Columns>
<telerik:GridBoundColumn DataField="ID" Display="False" UniqueName="ID"> <ItemStyle HorizontalAlign="Left" /> </telerik:GridBoundColumn><telerik:GridBoundColumn DataField="Name" HeaderText="Name" UniqueName="Name">
<ItemStyle HorizontalAlign="Left" />
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
<ClientSettings EnableRowHoverStyle="false"><Selecting AllowRowSelect="false" />
<Scrolling AllowScroll="true" SaveScrollPosition="true" UseStaticHeaders = "true" /> </ClientSettings>
</telerik:RadGrid>
Vb Code On page load : (DtWrAra is a datatable)
Private Sub AddDynamicColumns()
For c As Integer = 0 To DtWrAra.Count - 1Dim cbDownload As New GridTemplateColumn()
cbDownload.HeaderText = DtWrAra(c).Name
cbDownload.UniqueName = DtWrAra(c).Id
cbDownload.ItemTemplate = New RadGridCheckBoxTemplate(DtWrAra(c).Id)
Me.rdGrd.MasterTableView.Columns.Add(cbDownload)Next
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
rdGrd.DataSource = SampleDataSourceObject
AddDynamicColumns()
rdGrd.DataBind()
End Sub
========
These check box template columns are later checked on eachrow basis.
When i am performing sorting operation grid getting distorted .I am not Certain about the cause. Attached a screen shot..
If any one can help me on this ...
Thanks,
Saurabh