Hi, I would like to persist the grid row order after the user reorder it.
I'm almost there, but i cant get the "updated" values from the grid. Whenever I access the e.DestinationGrid.Items or the grid.Items on the RowDrop event, the grid isnt updated yet, so i'm stuck with the old values.
ASPX:
c#
So, can someone help?
Thanks! And sorry for the english!
                                I'm almost there, but i cant get the "updated" values from the grid. Whenever I access the e.DestinationGrid.Items or the grid.Items on the RowDrop event, the grid isnt updated yet, so i'm stuck with the old values.
ASPX:
<div>    <telerik:RadGrid ID="gridSubjects" runat="server" AllowPaging="True" AllowSorting="True"        AutoGenerateColumns="False" Skin="Telerik" OnDeleteCommand="gridSubjects_DeleteCommand"        OnNeedDataSource="gridSubjects_NeedDataSource" OnInsertCommand="gridSubjects_InsertCommand"        OnUpdateCommand="gridSubjects_UpdateCommand"        onrowdrop="gridSubjects_RowDrop">        <ClientSettings AllowRowsDragDrop="true" EnablePostBackOnRowClick="True">            <Selecting AllowRowSelect="True" EnableDragToSelectRows="false" />        </ClientSettings>        <MasterTableView DataKeyNames="SubjectID,Sequence" InsertItemPageIndexAction="ShowItemOnCurrentPage"            AutoGenerateColumns="false" CommandItemDisplay="Top" CommandItemSettings-AddNewRecordText="Adicionar"            CommandItemSettings-RefreshText="Atualizar">            <CommandItemSettings AddNewRecordText="Adicionar" RefreshText="Atualizar" ExportToPdfText="Export to PDF">            </CommandItemSettings>            <RowIndicatorColumn FilterControlAltText="Filter RowIndicator column">            </RowIndicatorColumn>            <ExpandCollapseColumn FilterControlAltText="Filter ExpandColumn column">            </ExpandCollapseColumn>            <Columns>                <telerik:GridDragDropColumn Visible="true" />                <telerik:GridTemplateColumn DataField="SubjectID" HeaderText="ID" UniqueName="SubjectID"                    Visible="false" ReadOnly="true">                </telerik:GridTemplateColumn>                <telerik:GridBoundColumn DataField="Name" HeaderText="Nome" UniqueName="Name" />                <telerik:GridBoundColumn DataField="Description" HeaderText="Descrição" UniqueName="Description" />                <telerik:GridHyperLinkColumn DataNavigateUrlFields="SubjectID" DataNavigateUrlFormatString="~/TrainingsControl/Topics.aspx?SID={0}"                    DataTextField="TopicsCount" DataTextFormatString="Tópicos ({0})" UniqueName="TopicsCount" />                <telerik:GridHyperLinkColumn DataNavigateUrlFields="QuizID,SubjectID" DataNavigateUrlFormatString="~/TrainingsControl/QuizzesControl/Quiz.aspx?QID={0}&SID={1}"                    UniqueName="Quiz" DataTextField="QuestionsCount" DataTextFormatString="Questionário ({0})" />                <telerik:GridEditCommandColumn ButtonType="ImageButton" />                <telerik:GridButtonColumn ConfirmText="Deseja realmente deletar o módulo?" ConfirmDialogType="RadWindow"                    ConfirmTitle="Confirmação" ButtonType="ImageButton" CommandName="Delete" ConfirmDialogHeight="100px"                    ConfirmDialogWidth="220px" />            </Columns>            <EditFormSettings>                <EditColumn UniqueName="EditCommandColumn1" FilterControlAltText="Filter EditCommandColumn1 column">                </EditColumn>            </EditFormSettings>        </MasterTableView>        <StatusBarSettings LoadingText="Carregando..." ReadyText="Pronto" />        <FilterMenu EnableImageSprites="False">        </FilterMenu>        <HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Telerik">        </HeaderContextMenu>    </telerik:RadGrid></div>c#
protected void gridSubjects_RowDrop(object sender, GridDragDropEventArgs e){    Subject subject = new Subject();    Dictionary<int, short> order = new Dictionary<int, short>();    //I tried the alternative below too    //foreach (GridDataItem item in gridSubjects.Items)    foreach (GridDataItem item in e.DestinationGrid.Items)    {        int subID = Int32.Parse(item.GetDataKeyValue("SubjectID").ToString());        short subSeq = Int16.Parse(item.GetDataKeyValue("Sequence").ToString());        order.Add(subID, subSeq);    }    using (Pro10Entities db = new Pro10Entities())    {        subject.Reorder(db, order);    }}So, can someone help?
Thanks! And sorry for the english!