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

[Solved] Total in Grid Multiple Pages

0 Answers 121 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Suresh K
Top achievements
Rank 1
Suresh K asked on 19 Jan 2010, 03:07 PM
Hi.
I have the Grid Like This with Check box.
here i want the Total of checked rows "CheckAmount".checkamount is one column in the grid
i am able to getting the Total in single page(grid page=1).
i am not able to getting the total of "CheckAmount" in multiple pages like (Grid Page=1 and Page=2 )
when i go to the second page i am not getting the 1st page Total.
<telerik:RadGrid ID="rgv" runat="server" AllowMultiRowEdit="True" 
                AllowMultiRowSelection="True" AllowPaging="True" AutoGenerateColumns="False" 
                EnableTheming="False" GridLines="None" Skin="trublue"  EnableEmbeddedSkins="False" 
                Style="position:static; margin-left:25px;" Width="740px" PageSize="10"
                <MasterTableView> 
                    <Columns> 
                        <telerik:GridTemplateColumn UniqueName="TemplateColumn"
                            <ItemTemplate> 
                                <asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="true" OnCheckedChanged="CheckBox1_CheckedChanged1" /> 
                            </ItemTemplate> 
                            <HeaderTemplate> 
                                <asp:Label ID="Label3" runat="server" Text="select"></asp:Label> 
                            </HeaderTemplate> 
                        </telerik:GridTemplateColumn> 
                        <telerik:GridBoundColumn DataField="id" DataType="System.Int32" HeaderText="ID" UniqueName="id" 
                            Visible="False"
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn DataField="ClientID" HeaderText="ClientID" SortExpression="uN" 
                            UniqueName="UserName" Visible="False"
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn DataField="BankID" HeaderText="BankID" SortExpression="pwd" 
                            UniqueName="p1" Visible="False"
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn DataField="CheckNumber" HeaderText="CheckNumber" SortExpression="CP" 
                            UniqueName="CP"
                            <HeaderStyle HorizontalAlign="Center" /> 
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn DataField="CheckDate" HeaderText="CheckDate" SortExpression="mail" 
                            UniqueName="Email"
                            <HeaderStyle HorizontalAlign="Center" /> 
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn DataField="CheckReceivedOn" HeaderText="CheckReceivedOn" 
                            SortExpression="SQ" UniqueName="SQ"
                            <HeaderStyle HorizontalAlign="Center" /> 
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn DataField="CheckAmount" HeaderText="CheckAmount" SortExpression="SA" 
                            UniqueName="CheckAmount"
                            <HeaderStyle HorizontalAlign="Right" /> 
                            <ItemStyle HorizontalAlign="Right" /> 
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn DataField="DepositeDate" HeaderText="DepositeDate" SortExpression="SA" 
                            UniqueName="DD" Visible="False"
                        </telerik:GridBoundColumn> 
                        <telerik:GridBoundColumn DataField="InvoiceNo" HeaderText="InvoiceNo" SortExpression="SA" 
                            UniqueName="INO"
                            <HeaderStyle HorizontalAlign="Center" /> 
                        </telerik:GridBoundColumn> 
                    </Columns> 
                    <EditFormSettings> 
                        <EditColumn UniqueName="EditCommandColumn1" CancelImageUrl="trublue/Grid/Cancel.gif" EditImageUrl="trublue/Grid/Edit.gif"  
                        InsertImageUrl="trublue/Grid/Update.gif" UpdateImageUrl="trublue/Grid/Update.gif"
                        </EditColumn> 
                    </EditFormSettings> 
                </MasterTableView> 
                 
                <FilterMenu EnableTheming="False" EnableEmbeddedSkins="False">      
                </FilterMenu> 
                <ClientSettings EnableRowHoverStyle="True"
                    <Selecting AllowRowSelect="True" /> 
                </ClientSettings> 
                <HeaderContextMenu EnableEmbeddedSkins="False"
                </HeaderContextMenu> 
            </telerik:RadGrid> 
 I am using this Code to Get the checked rows total "CheckAmount".
Protected Sub CheckBox1_CheckedChanged1(ByVal sender As Object, ByVal e As EventArgs) 
        Dim CheckBox1 As New System.Web.UI.WebControls.CheckBox 
        Dim count, crcount, f1 As Integer 
        Dim mainval, tempval As String 
        Me.txttotal.Visible = True 
        Me.lbltotalamt.Visible = True 
        txttotal.Text = 0 
        'rgv.ExportSettings.IgnorePaging = False 
        For Each item1 As GridDataItem In rgv.Items 
            CheckBox1 = CType(item1.FindControl("CheckBox1"), System.Web.UI.WebControls.CheckBox) 
            If CheckBox1.Checked = True Then 
                Dim a As Decimal 
                Dim stramount() As String 
                countcount = count + 1 
                stramount = item1("CheckAmount").Text.Split(" ") 
                'add = TextBox1.Text + row.Cells(2).Text 
                a = Convert.ToDecimal(txttotal.Text.Trim()) + Convert.ToDecimal(stramount(0)) ' Convert.ToInt32(dt.Rows(0).Item(1).ToString.Trim) 
                ' MsgBox(a) 
                Me.txttotal.Text = a 
            End If 
        Next 
 End Sub 

Can any one help me how to get the Total in Multiple pages in Grid.
Thanks
Suresh K.

No answers yet. Maybe you can help?

Tags
Grid
Asked by
Suresh K
Top achievements
Rank 1
Share this question
or