or
| for (var i = 0; i < rows.length; i++) { |
| if (rows[i].ItemType == "EditItem") { editedRow = rows[i]; break; } |
| } |
| var view = grid.get_masterTableView(); |
| var rows = view.get_dataItems(); |
| masterTable.editItem(masterTable.get_dataItems()[0].get_element()); |
| masterTable.editSelectedItems(); |
| masterTable.updateEditedItems(); |
| masterTable.editAllItems(); |
| <telerik:RadAjaxManager ID="_pastManager" runat="server" EnableAJAX="true"> |
| <AjaxSettings> |
| <telerik:AjaxSetting AjaxControlID="_pastItemsGrid"> |
| <UpdatedControls> |
| <telerik:AjaxUpdatedControl ControlID="_pastItemsGrid" /> |
| <telerik:AjaxUpdatedControl ControlID="_selectedAmount" /> |
| <telerik:AjaxUpdatedControl ControlID="_selectedValue" /> |
| <telerik:AjaxUpdatedControl ControlID="_continueBtn" /> |
| </UpdatedControls> |
| </telerik:AjaxSetting> |
| </AjaxSettings> |
| </telerik:RadAjaxManager> |
| <%--Grid containing the results--%> |
| <div style="margin: 15px 5px 15px 5px;"> |
| <telerik:RadGrid ID="_pastItemsGrid" runat="server" AllowMultiRowSelection="true" |
| ShowFooter="false" AutoGenerateColumns="false" AllowSorting="true" Skin="Web20"> |
| <HeaderStyle Font-Bold="true" HorizontalAlign="Left" /> |
| <PagerStyle Mode="NextPrevAndNumeric" Position="TopAndBottom" /> |
| <ClientSettings EnablePostBackOnRowClick="true"> |
| <Selecting AllowRowSelect="true" /> |
| </ClientSettings> |
| <MasterTableView DataKeyNames="TranID"> |
| <Columns> |
| <telerik:GridBoundColumn HeaderText="Date" DataField="Date" /> |
| <telerik:GridBoundColumn HeaderText="Description" DataField="Description" /> |
| <telerik:GridBoundColumn HeaderText="Amount" DataField="Amount" UniqueName="Amount" /> |
| <telerik:GridTemplateColumn HeaderText="Reward Value" UniqueName="Value"> |
| <ItemTemplate> |
| <div style="color: #0DAE4B;"> |
| <asp:Label ID="_milesLabel" runat="server" Text='<%# GetCurrency(Eval("Miles")) %>' /> |
| </div> |
| </ItemTemplate> |
| </telerik:GridTemplateColumn> |
| <telerik:GridClientSelectColumn HeaderText="Select" UniqueName="checkSelect" CommandName="RowClick" /> |
| </Columns> |
| <NoRecordsTemplate> |
| <div> |
| There were no records found.</div> |
| </NoRecordsTemplate> |
| </MasterTableView> |
| </telerik:RadGrid> |
| <div style="padding-top: 5px;"> |
| <div style="float: left; font-size: 14px; font-weight: bold; width: 370px; text-align: right; |
| padding-right: 10px;"> |
| Total Purchase Credit Amount: |
| </div> |
| <div style="font-weight: bold; font-size: 12px; float: left; width: 119px;"> |
| <asp:Label ID="_selectedAmount" runat="server" Text="$0.00" /> |
| </div> |
| <div style="color: #0DAE4B; font-weight: bold; font-size: 12px; float: left;"> |
| <asp:Label ID="_selectedValue" runat="server" Text="0" /> |
| </div> |
| <div style="float: right;"> |
| <asp:Button ID="_continueBtn" runat="server" Text="Credit" /> |
| </div> |
| <div class="clear"> |
| </div> |
| </div> |
| <div class="clear"> |
| </div> |
| </div> |
| Protected Sub _pastItemsGrid_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles _pastItemsGrid.NeedDataSource |
| Dim ds As New DataSet |
| ds.ReadXml(Server.MapPath("../Transactions.xml")) |
| _pastItemsGrid.DataSource = ds |
| End Sub |
| Protected Sub _pastItemsGrid_ItemCommand(ByVal sender As Object, ByVal e As GridCommandEventArgs) Handles _pastItemsGrid.ItemCommand |
| Dim amountTotal As New Decimal |
| Dim rewardTotal As Integer = 0 |
| If e.CommandName = "RowClick" Then |
| For Each dataItem As GridDataItem In _pastItemsGrid.MasterTableView.Items |
| If dataItem.Selected Then |
| '' Get the label control which has the value. |
| Dim toChange As Label = CType(dataItem.Item("Value").FindControl("_milesLabel"), Label) |
| '' Seperate out the value from the currency wording. |
| Dim splitValue As Array = toChange.Text.Split(" ") |
| '' Replace any commas in the value so that it can be converted. |
| Dim test As String = splitValue(0).ToString.Replace(",", "") |
| '' Convert the value and add to total. |
| rewardTotal += CInt(test) |
| '' Conver the amount and add to total. |
| amountTotal += CDec(dataItem.Item("Amount").Text) |
| End If |
| Next |
| End If |
| '' Update both amount and currency value for user. |
| _selectedAmount.Text = String.Format("{0:C2}", amountTotal) |
| _selectedValue.Text = String.Format("{0:#,##}", rewardTotal) |
| End Sub |