Click here to Skip to main content
15,887,135 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I need some help on how to do some calculations in a gridview.
I have a rate column and a number column that is a textbox.
I would like to multiply the rate column by the textbox to make the totals column.

ASP.NET
<body>
    <form id="form1" runat="server">
    <div>
    
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataSourceID="AccessDataSource1">
            <Columns>
                <asp:BoundField DataField="Description" HeaderText="Description" 
                    SortExpression="Description" />
                <asp:BoundField DataField="Rate" HeaderText="Rate" SortExpression="Rate"/>
                <asp:TemplateField HeaderText="Number">
                <ItemTemplate>
                    <asp:TextBox runat="server">
                    </asp:TextBox></ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField HeaderText="Total">
                <ItemTemplate>
              
                </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
        <asp:AccessDataSource ID="AccessDataSource1" runat="server" 
            DataFile="~/App_Data/gridView.accdb" 
            SelectCommand="SELECT [Description], [Rate] FROM [grid]">
        </asp:AccessDataSource>
    
        <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
    
    </div>
    </form>
</body>


Please help.
Posted

 
Share this answer
 
Comments
thatraja 18-Jan-12 3:32am    
5! BTW you know GIT?
Prasad_Kulkarni 18-Jan-12 6:08am    
till now i wasn't..but now yes i know:)
thank you
thatraja 18-Jan-12 6:12am    
You too welcome there
Prasad_Kulkarni 18-Jan-12 6:15am    
thanks man,you r really a nice person. srinivas is d lucky charm he owned you.
thatraja 23-Jan-12 9:06am    
Thank you, BTW be active there, that forum is for Indian people
 
Share this answer
 
Comments
thatraja 18-Jan-12 3:33am    
5! BTW you know GIT?
Anuja Pawar Indore 18-Jan-12 3:38am    
Nope, just saw the link :)
thatraja 18-Jan-12 3:44am    
You welcome there
Anuja Pawar Indore 18-Jan-12 4:22am    
Yup added. Thanks for sharing :)
thatraja 23-Jan-12 9:07am    
Welcome, keep posting there, that forum is for Indian people

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900