When I change the order of the items/rows in the grid using client side code, I would like to find the new order representation.
I used the MasterTableView.Items collection and I end up with the original order, as when I bind the grid with the data.
What is the correct collection property to iterate through to retrieve the current row order of the rearranged grid?
<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
<script type="text/javascript">
var _selectedRow;
function radgvAddress_RowSelected(sender, args) {
_selectedRow = $get(args.get_id());
}
function moveRowUp() {
if (_selectedRow && _selectedRow.sectionRowIndex > 0) {
swapRows(_selectedRow, _selectedRow.parentNode.rows[_selectedRow.sectionRowIndex - 1])
}
}
function moveRowDown() {
if (_selectedRow && _selectedRow.sectionRowIndex < _selectedRow.parentNode.rows.length - 1) {
swapRows(_selectedRow, _selectedRow.parentNode.rows[_selectedRow.sectionRowIndex + 1])
}
}
function serializeChanges(index1, index2) {
var reorderInput = document.getElementById("ReorderChanges");
if (reorderInput) {
reorderInput.value += index1 + "," + index2 + ";";
}
}
function swapRows(sourceRow, targetRow) {
for (var i = 0; i < sourceRow.cells.length; i++) {
var cellContent1 = targetRow.cells[i].innerHTML;
var cellContent2 = sourceRow.cells[i].innerHTML;
targetRow.cells[i].innerHTML = cellContent2;
sourceRow.cells[i].innerHTML = cellContent1;
}
$find("<%= radgvAddress.MasterTableView.ClientID %>").selectItem(targetRow);
serializeChanges(sourceRow.sectionRowIndex, targetRow.sectionRowIndex);
}
</script>
</telerik:RadScriptBlock>
<telerik:RadNumericTextBox ID="txtQuantityE" autocomplete="off" runat="server" Skin="Hay" EmptyMessage="Enter Quantity" SelectionOnFocus="CaretToEnd" ToolTip="Enter Quantity to place Order" Culture="English (United States)" Height="14px" Width="141px" MaxValue="9999" MinValue="1"> <NumberFormat GroupSeparator="" DecimalDigits="0" AllowRounding="true" KeepNotRoundedValue="false" /> <ClientEvents OnKeyPress="KeyPress" /> </telerik:RadNumericTextBox>function show(txtQuantityE, lblRate, lblAmount, Amount) { var txtQuantityE = $find(txtQuantityE); var lblRate = document.getElementById(lblRate); var lblAmount = document.getElementById(lblAmount); var Amount = document.getElementById(Amount); Amount.value = parseInt(txtQuantityE.get_value()) * parseInt(lblRate.innerHTML); lblAmount.innerHTML = parseInt(txtQuantityE.get_value()) * parseInt(lblRate.innerHTML); } function KeyPress(sender, args) { if (args.get_keyCharacter() == sender.get_numberFormat().DecimalSeparator) { args.set_cancel(true); } if(args.get_keyCode() == 45) { alert("Enter non-negative numbers only"); args.set_cancel(true); } }txtQauntityE.Attributes.Add("onblur", "return show('" + txtQauntityE.ClientID + "','" + lblRate.ClientID + "','" + lblAmount.ClientID + "','" + Amount.ClientID + "')");
<asp:Panel ID="Panel3" Width="112px" BorderWidth="1px" runat="server"> <telerik:RadListView runat="server" ID="RadListView1" DataSourceID="SMapXmlDataSource" > <ItemTemplate> <asp:Panel class="rlvI" ID="Panel1" BorderWidth="2px" BorderColor="Red" style="vertical-align:middle;" Height="35px" Width="52px" runat="server"> <asp:ImageButton ID="SMapImageButton" runat="server" CommandArgument='<%# XPath("@name") %>' ImageUrl='<%# string.Format("~/Common/Img/Cities/{0}/SmallMaps/{1}.jpg", City, XPath("@name").ToString()) %>' CommandName="SmallMaps" Height="32px" BackColor="Blue" OnCommand="CommonSmallMapImageButton_Command" Width="50px" /> </asp:Panel> </ItemTemplate> <LayoutTemplate> <div class="RadListView RadListViewFloated RadListView_<%# Container.Skin %>" > <div class="rlvFloated rlvAutoScroll"> <div id="itemPlaceholder" runat="server"> </div> </div> </div> </LayoutTemplate> </telerik:RadListView> </asp:Panel>
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default3.aspx.vb" Inherits="Default3" %> <%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> </head> <body> <form id="form1" runat="server"> <telerik:RadGrid ID="rgd_MyRequests" runat="server" DataSourceID="sds_MyRequests" GridLines="None" Skin="WebBlue" Width="800px"> <MasterTableView AutoGenerateColumns="False" DataSourceID="sds_MyRequests"> <CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings> <RowIndicatorColumn> <HeaderStyle Width="20px"></HeaderStyle> </RowIndicatorColumn> <ExpandCollapseColumn> <HeaderStyle Width="20px"></HeaderStyle> </ExpandCollapseColumn> <Columns> <telerik:GridBoundColumn DataField="EnteredDate" DataType="System.DateTime" HeaderText="Entered Date" SortExpression="EnteredDate" UniqueName="EnteredDate" ItemStyle-Width="75px" DataFormatString="{0:MM/dd/yyyy}" ItemStyle-HorizontalAlign="Center"> <ItemStyle HorizontalAlign="Center" Width="75px"></ItemStyle> </telerik:GridBoundColumn> <telerik:GridRatingColumn DataField="Priority" UniqueName="column" ReadOnly="True" HeaderText="Priority"> <ItemStyle Width="70px" Wrap="False" /> </telerik:GridRatingColumn> <telerik:GridBoundColumn DataField="Status" DataType="System.Int32" HeaderText="Status" SortExpression="Status" UniqueName="Status" ItemStyle-Width="25px" ItemStyle-HorizontalAlign="Center"> <ItemStyle HorizontalAlign="Center" Width="25px"></ItemStyle> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="CategoryName" HeaderText="Issue Category" SortExpression="CategoryName" UniqueName="CategoryName" DataType="System.Int32" ItemStyle-Width="75px"> <ItemStyle Width="75px"></ItemStyle> </telerik:GridBoundColumn> <telerik:GridBoundColumn DataField="Subject" HeaderText="Subject" SortExpression="Subject" UniqueName="Subject"> </telerik:GridBoundColumn> </Columns> <HeaderStyle Font-Bold="False" Font-Italic="False" Font-Overline="False" Font-Strikeout="False" Font-Underline="False" HorizontalAlign="Center" Wrap="True" /> </MasterTableView> </telerik:RadGrid> <asp:SqlDataSource ID="sds_MyRequests" runat="server" ConnectionString="<%$ ConnectionStrings:IT_CentralConnectionString %>" SelectCommand="SELECT [EnteredDate], [Priority], [Status], [CategoryName], [Subject] FROM [vw_ITC_Ticket_Details] WHERE [RequestorUserName] = 'hpotter' AND (CompletedDate IS NULL) ORDER BY [EnteredDate]"> </asp:SqlDataSource> <telerik:RadScriptManager ID="RadScriptManager1" runat="server"> </telerik:RadScriptManager> </form> </body> </html>
AllowEdit property to false - to prevent node became editable when clicked.
in the button_Click eventhandler i put call to
startNodeInEditMode function
as in the following code:
public void startNodeInEditMode(string nodeValue) { string js = "Sys.Application.add_load(editNode); function editNode(){ "; js += "var tree = $find(\"" + RadTreeView1.ClientID + "\");"; js += "var node = tree.get_selectedNode();"; js += "if (node) node.startEdit();"; js += "Sys.Application.remove_load(editNode);};"; RadScriptManager.RegisterStartupScript(Page, Page.GetType(), "nodeEdit", js, true); } protected void RadTreeView1_NodeEdit(object sender, RadTreeNodeEditEventArgs e) {e.Node.Text = e.Text;
The Problem :
The changed text of the node returns back to old version of text (the changes suddenly disappear after few seconds and old text appear)
Althougt i see that changes are saved in db inside the RadTreeView1_NodeEdit function.
Please help

I have a requirement for a project that I'm having some difficulty getting to work. I've looked at the following post, http://www.telerik.com/community/forums/aspnet-ajax/grid/client-side-expand-collapse-of-group.aspx, but it only takes me so far. For my page, I have a grid that is configured for client-side grouping. I have a requirement that the expanded groups are persisted on grid rebind. There is a control on the page that allows the user to select from a list of items that translate to the groups in the grid. So, the user selects 3 items in the list and there are 3 groups of those selected items in the grid, the user selects 5 items from the list and there are 5 groups in the grid, etc. In other words the number of groups is variable based on user selection.
I've set up a web service to handle the persisting of the group information via ajax callback from the page, and that all works fine. The problem I'm having is that there isn't any way to get the selected group information in the OnGroupExpanded or OnGroupCollapsed events. It appears that the sender is the grid itself and the event args are empty? I currently have the following code, based on the link above:
<telerik:RadGrid ...> <ClientSettings EnableRowHoverStyle="false"> <ClientEvents OnGroupExpanded="groupExpanded" /> </ClientSettings> ...</telerik:RadGrid>
function groupExpanded(sender, e) {var grid = $find(sender.get_id());var expandedGroupItems = grid._expandedGroupItems;var lastItemId = expandedGroupItems[expandedGroupItems.length - 1];alert("Owner TableView: " + lastItemId.split('!')[0]);alert("Table Row Index : " + lastItemId.split('!')[1]);}
Also, I'd like to say that the documentation for OnGroupsExpanded and OnGroupsCollapsed is incorrect. It states that the sender is a GridDataItem, when in fact it is the grid itself. It is a bit confusing.
Any and all help would be greatly appreciated.
Thanks,
-Matt.
