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

Drag and Drop Single Grid

1 Answer 63 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David Gunderson
Top achievements
Rank 1
David Gunderson asked on 31 May 2011, 04:37 PM

What I am trying to do is reorder a set of questions.  What i pull into the grid is the
intQuestionID, strQuestion and the intOrder

What I want to be able to do is drag and drop and reorder the questions, do you have an example of doing this only server side using the Radgrid_rowDrop.

<tr>
                                <td align="left"><telerik:RadGrid ID="myRad" runat="server" ClientSettings-AllowRowsDragDrop="true" ClientSettings-Selecting-AllowRowSelect="true"
                                    ClientSettings-Selecting-EnableDragToSelectRows="false">
                                    <MasterTableView AutoGenerateColumns="false" DataKeyNames="intQuestionId">
                                    <HeaderStyle ForeColor="White" CssClass="backColor" BackColor="Steelblue" Font-Bold="true" BorderColor="#404040" BorderWidth="1px" />
                                        <Columns>
                                            <telerik:GridDragDropColumn HeaderStyle-Width="18px"></telerik:GridDragDropColumn>
                                            <telerik:GridBoundColumn DataField="strQuestion" HeaderText="Question"></telerik:GridBoundColumn>
                                            <telerik:GridBoundColumn DataField="IntOrder" HeaderText="Order"></telerik:GridBoundColumn>
                                        </Columns>
                                    </MasterTableView>
                                </telerik:RadGrid></td>
                            </tr>

 Protected Sub ddlQuestions_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlQuestions.SelectedIndexChanged
        Dim catId As String = ddlQuestions.SelectedValue

        If catId = "0" Then
            ScriptManager.RegisterClientScriptBlock(Page, GetType(Page), "OpenWindow", "PickCategory();", True)
        Else
            FillGrid()
        End If
    End Sub

Private Sub FillGrid()
        Dim CatId As String = ddlQuestions.SelectedValue
        Dim itemCount As Integer = 0

        sql = "Select intQuestionId, strQuestion, intOrder from tblSRPQuestion where intCategoryID = " & CatId
    
        myDataTable = New DataTable
        myDataTable = getData(sql)

        myRad.DataSource = getData(sql)
        myRad.DataBind()

    End Sub

  
    Protected Sub myRad_RowDrop(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridDragDropEventArgs) Handles myRad.RowDrop

    End Sub

1 Answer, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 01 Jun 2011, 09:34 AM
Hello David,

Please examine the Drag and drop to reorder rows in grid code library to see how the desired functionality can be implemented.

I hope this helps.

Greetings,
Mira
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
David Gunderson
Top achievements
Rank 1
Answers by
Mira
Telerik team
Share this question
or