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

RadGrid with dynamic columns

4 Answers 553 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Johnny
Top achievements
Rank 2
Johnny asked on 14 Jul 2011, 11:04 AM
hi i adding columns to RadGrid on RadButton Click event
all working fine
when i sort the grid with Header Click or When i Filter the grid
the RadGrid disappeared i suspect the columns or removed automatically after that if i click any button to postback the RadGrid appear with dynamic columns but no data  inside the rows
this is my code

 

 

 

RadGrid1.Columns.Clear()
 Dim bc As New GridBoundColumn
 RadGrid1.MasterTableView.Columns.Add(bc)
 bc.DataField = "File Name"
 bc.HeaderText = "File Name"
 bc.SortExpression = "File Name"
 'bc.ItemStyle.Width = New Unit(80, UnitType.Pixel)
 bc = New GridBoundColumn
 RadGrid1.MasterTableView.Columns.Add(bc)
 bc.DataField = "File Path"
 bc.HeaderText = "File Path"
 bc.SortExpression = "File Path"
RadGrid1.DataSource = profiledatas
 RadGrid1.DataBind()

  

aspx 
 

 

<telerik:RadGrid ID="RadGrid1" AllowSorting="true" AllowFilteringByColumn="true"   AutoGenerateColumns="false"    runat="server">
        <MasterTableView>
                 <Columns>
                                    
                  </Columns>
                  <ItemStyle HorizontalAlign="Left" />
                   <HeaderStyle HorizontalAlign="Left" />
           </MasterTableView>
</telerik:RadGrid>

 

 my RadGrid inside RadAjaxPanel

 

how to solve this issue

4 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 21 Jul 2011, 11:22 AM
Hello Johnny,

There are three ways to create your control/structure programmatically:
I'm afraid we do not support adding columns on button click.

Regards,
Daniel
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Johnny
Top achievements
Rank 2
answered on 25 Jul 2011, 05:38 AM
Hi Daniel

  You mean i could create columns on_Page load and Page_Init event oni ah, hopeless

I m using  2011 Q2 controls, so the Telerik RadGrid doesn't support add columns on Button_Click or other events ?

You mean if i create columns on Page_Load or Page_Init oni the RadGrid will support Edit, Sorting, Filetering ................



0
Johnny
Top achievements
Rank 2
answered on 26 Jul 2011, 03:25 AM
hi can u answer my question
cs i need to decide to use this RadGrid in my project or not
0
Daniel
Telerik team
answered on 28 Jul 2011, 09:37 PM
Hello Johnny,

Indeed, you can create RadGrid using one of the approaches mentioned in my previous answer. This will ensure that the ViewState is tracked correctly and all of the built-in functions will work properly as expected.

Best regards,
Daniel
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

Tags
Grid
Asked by
Johnny
Top achievements
Rank 2
Answers by
Daniel
Telerik team
Johnny
Top achievements
Rank 2
Share this question
or