or
Dim expression As GridSortExpression = New GridSortExpression()<br> expression.FieldName = str(intI)<br> expression.SortOrder = GridSortOrder.Descending<br> rgContractHistory.MasterTableView.SortExpressions.AddSortExpression(expression) <telerik:GridTemplateColumn ItemStyle-BorderWidth="0" HeaderStyle-Font-Bold="true" ItemStyle-HorizontalAlign="Left" UniqueName="CustomerName"<br><span class="Apple-tab-span" style="white-space:pre"> </span>ShowSortIcon="false"><br><span class="Apple-tab-span" style="white-space:pre"> </span><ItemTemplate><br><span class="Apple-tab-span" style="white-space:pre"> </span><asp:Label ID="lblCustomerOrganization" runat="server" Text='<%# Eval("CustomerOrganization")%>'/><br><span class="Apple-tab-span" style="white-space:pre"> </span></ItemTemplate><br><span class="Apple-tab-span" style="white-space:pre"> </span></telerik:GridTemplateColumn><telerik:RadGrid ID="grdInvoiceItems" runat="server" Width="934px" AutoGenerateColumns="false" EnableViewState="true" AllowMultiRowEdit="false" onitemcreated="grdInvoiceItems_ItemCreated" Skin="Silk" ShowHeader="false" style="border:0" BorderColor="#CCCCCC"> <ClientSettings> <ClientEvents OnRowMouseOver="showContent" OnRowMouseOut="hideContent" OnCommand="gridCommand" OnRowDataBound="RowDataBound" /> </ClientSettings> <MasterTableView ClientDataKeyNames="Id,Description" DataKeyNames="Id" CommandItemDisplay="None" > <ItemStyle Height="50px" /> <AlternatingItemStyle Height="50px" /> <Columns> <telerik:GridBoundColumn DataField="Id" HeaderText="Id" UniqueName="Id"></telerik:GridBoundColumn> <telerik:GridTemplateColumn DataField="Item" UniqueName="Item"> <ItemStyle /> <ItemTemplate> <telerik:RadComboBox ID="ddlItems" runat="server" AutoPostBack="false" DataSourceID="objItems" DataTextField="Items" DataValueField="Items" Skin="Default" OnClientDropDownOpening="DropDownOpening" OnClientSelectedIndexChanged="ItemValueChanged" EnableViewState="true" AllowCustomText="False" Width="160px" Height="150px" ondatabound="ddlItems_DataBound" EmptyMessage="Select an item" FocusedStyle-BackColor="#fff6dc" > </telerik:RadComboBox> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn DataField="Description" HeaderText="Description" UniqueName="Description"> <ItemStyle /> <ItemTemplate> <telerik:RadTextBox ID="txtDescription" Width="320px" Height="30px" CssClass="ItemsGridTextBoxAlighLeft" runat="server" FocusedStyle-BackColor="#fff6dc"></telerik:RadTextBox> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn DataField="Price" HeaderText="Price" UniqueName="Price"> <ItemStyle Width="100px" /> <ItemTemplate> <telerik:RadNumericTextBox ID="txtPrice" Width="100px" Height="30px" CssClass="ItemsGridPriceTextBox" runat="server" FocusedStyle-BackColor="#fff6dc" > <ClientEvents OnValueChanged="PriceChanged" OnFocus="OnPriceFocusGetColumnValues" /> </telerik:RadNumericTextBox> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn DataField="Qty" HeaderText="Qty" UniqueName="Qty"> <ItemStyle Width="50px" /> <ItemTemplate> <telerik:RadNumericTextBox ID="txtQty" Width="50px" Height="30px" CssClass="ItemsGridQtyTextBox" runat="server" FocusedStyle-BackColor="#fff6dc" > <NumberFormat DecimalDigits="0" /> <ClientEvents OnValueChanged="QtyChanged" OnFocus="OnQtyFocusGetColumnValues" /> </telerik:RadNumericTextBox> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn DataField="Discount" HeaderText="Discount" UniqueName="Discount"> <ItemStyle Width="85px" CssClass="ColumnDiscount" /> <ItemTemplate> <telerik:RadNumericTextBox ID="txtDiscount" Width="85px" Height="30px" CssClass="ItemsGridDiscountTextBox" runat="server" FocusedStyle-BackColor="#fff6dc"> <ClientEvents OnValueChanged="DiscountChanged" OnFocus="OnDiscountFocusGetColumnValues" /> </telerik:RadNumericTextBox> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn DataField="Amount" HeaderText="Amount" UniqueName="Amount" > <ItemStyle Width="105px" /> <HeaderStyle Width="105px" HorizontalAlign="Center" /> <ItemTemplate > <telerik:RadNumericTextBox ID="lblAmount" runat="server" CssClass="ItemsGridAmount" Width="105px" Height="30px" > <ClientEvents OnValueChanged="AmountChanged" /> </telerik:RadNumericTextBox> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridTemplateColumn> <HeaderStyle Width="0px" /> <ItemStyle BorderStyle="None" CssClass="ImgColumn" /> <ItemTemplate> <div id="deleteRow" class="myWrap1" style="visibility:hidden" onclick="DeleteRow();"> <asp:HyperLink ID="DeleteLink" runat="server"> <asp:Image ID="DeleteCategory" runat="server" ImageUrl="~/Images/icons/test/Delete.png" AlternateText="Delete Row" /> </asp:HyperLink> </div> </ItemTemplate> </telerik:GridTemplateColumn> <telerik:GridBoundColumn DataField="InvoiceId" HeaderText="InvoiceId" UniqueName="InvoiceId" ItemStyle-CssClass="InvoiceIdColumn"> </telerik:GridBoundColumn>foreach (GridDataItem item in grdInvoiceItems.Items) { //object id = (object)item.OwnerTableView.DataKeyValues[item.ItemIndex]["Id"]; object value = item["Id"].Text; id = (item["Id"].FindControl("lblId") as RadTextBox).Text; string lineItem = (item["Item"].FindControl("ddlItems") as RadComboBox).Text; string description = (item["Description"].FindControl("txtDescription") as RadTextBox).Text; double? price = (item["Price"].FindControl("txtPrice") as RadNumericTextBox).Value; double? qty = (item["Qty"].FindControl("txtQty") as RadNumericTextBox).Value; double? discount = (item["Discount"].FindControl("txtDiscount") as RadNumericTextBox).Value; //double tax = double.Parse(lblTaxes.Text); //Label amount1 = (item["Amount"].FindControl("lblAmount") as Label); //string amount = item["Amount"].Text; //Label amount1 = (item.FindControl("lblAmount") as Label); double? amounnt = (item["Amount"].FindControl("lblAmount") as RadNumericTextBox).Value; if (!string.IsNullOrEmpty(lineItem)) { Invoice.UpdateInvoiceItems(Convert.ToInt32(id), lineItem, description, Convert.ToDouble(price), Convert.ToInt32(qty), Convert.ToDouble(discount), 0, Convert.ToDouble(amounnt)); } }