Using SwapColumns for Autogenerated columns in Prerender causing Itemdatabound to execute twice

Thread is closed for posting
2 posts, 0 answers
  1. cns
    cns avatar
    1 posts
    Member since:
    Aug 2015

    Posted 05 Aug 2015 Link to this post


    I am using autogenerated columns for my grid in which I need to swap columns. I have used "SwapColumns" in my "prerender" function. The problem is that my itemdatabound executes before (which is correct) and even after the prerender call has been made. I have checked and the issue is not because of a null datatable. Please could you provide me a solution for this as this problem was not encountered before.


  2. Maria Ilieva
    Maria Ilieva avatar
    4017 posts

    Posted 10 Aug 2015 Link to this post


    Try swapping the columns using the PageLoad event like this:
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
           If RadGrid1.MasterTableView.AutoGeneratedColumns.Length > 2 Then
               RadGrid1.MasterTableView.SwapColumns("columnName1", "columnName2")
           End If
       End Sub

    Maria Ilieva
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top