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

radgrid.mastertableview.swapcolumns not working???

1 Answer 128 Views
Grid
This is a migrated thread and some comments may be shown as answers.
chaitanya
Top achievements
Rank 1
chaitanya asked on 11 Oct 2011, 05:05 PM
Hi,

i have a radgrid with autogeneratedcolumns option as true. i disabled the viewstate for grid.  whenever a column reorder happens, i have to move some more columns.i am trying to move the extra columns through server side implementation. i am doing this in Prerender event of radgrid. The drag and drop column is moving to dropped position. However i am unable to move the extra columns. please help me out regarding this. i am trying for this for whole day but in vain :(

i made the following settings for my grid
EnableColumnsViewState="true"
AllowColumnsReorder="True",  ReorderColumnsOnClient="false"

grid PreRender code for moving the extra columns
protected void grdSummary_PreRender(object sender, EventArgs e)
{
//Holds the Unique names of columns to be moved
string[] extraColumns =new string(commasepratedColumnNames)
//column that was dragged and dropped
GridColumn mainColumnObject = grdSummary.MasterTableView.GetColumn("34");
                        index = mainColumnObject.OrderIndex;
                        foreach (string columnUniqueName in extraColumns)
                        {                            

                            grdSummary.MasterTableView.SwapColumns(columnUniqueName, mainColumnObject.UniqueName);                            
                        }
                        grdSummary.MasterTableView.Rebind();
}

Thanks,
Chaitanya

1 Answer, 1 is accepted

Sort by
0
Tsvetoslav
Telerik team
answered on 13 Oct 2011, 08:20 AM
Hi Chaitanya,

I could not see anything wrong with your code snippet. In addition, it is not clear what exactly went wrong - do you get any exception or the columns are just not moving. Please, paste your complete aspx and code-behind using the CODE FORMATTER tool of the ticket editor or what's better open up a formal support ticket and send your files so that we can debug them on our side. Thanks for that.

Best wishes, Tsvetoslav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Tags
Grid
Asked by
chaitanya
Top achievements
Rank 1
Answers by
Tsvetoslav
Telerik team
Share this question
or