ComponentOne GridView for ASP.NET WebForms
Task-Based Help / Updating the Grid with AJAX / Moving Columns
In This Topic
    Moving Columns
    In This Topic

    You can use AJAX to update the grid when the user moves columns at run time. For example, you can update the grid with AJAX on column move in the Designer, in Source view, and in code.

    In the Designer

    To enable AJAX when moving a column, complete the following steps:

    1. Select the C1GridView control and set the AllowColMoving property to True in the Properties window. If you run the program now, you will notice that the whole page refreshes when you move a column.
    2. In the project, with C1GridView still selected, expand the CallbackSettings node, click the drop-down arrow next to the Action property in the Properties window, and check the ColMove check box.

    In Source View

    Switch to Source view and add AllowColMoving="True" and CallbackOptions="ColMove" to the <cc1:C1GridView> tag, so it appears similar to the following:

    <cc1:C1GridView ID="C1GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="AccessDataSource1" VisualStylePath="~/C1WebControls/VisualStyles" AllowColMoving="True" CallbackOptions="ColMove">
    

    In Code

    To enable AJAX when moving a column, add the following code to the Page_Load event:

    To write the code in Visual Basic:

    Visual Basic
    Copy Code
    C1GridView1.AllowColMoving = True
    C1GridView1.CallbackOptions = CallbackOptions.ColMove

    To write the code in C#:

      
    C#
    Copy Code
    C1GridView1.AllowColMoving = true;
    C1GridView1.CallbackOptions = CallbackOptions.ColMove;

    What You've Accomplished

    Run the program and move a column. You will notice only the grid refreshes, not the entire page.

    See Also