Click here to Skip to main content
15,845,565 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="false" ShowFooter="true">
<asp:BoundField DataField="ItemDescription" HeaderText="Item"/>
<asp:TemplateField HeaderText="Amount">
<asp:TextBox ID="TextBox1" runat="server"

What I have tried:

string calc = "select * from calculation";
                using (SqlCommand cmd = new SqlCommand(calc, con))
                    SqlDataAdapter da = new SqlDataAdapter(cmd);
                          if (dt.Rows.Count > 0)
                            GridView1.DataSource = dt;

OriginalGriff 8-Oct-23 5:39am    
You have told us nothing about what is happening, or when it happens; what you have done to try and isolate the problem, and what you found. We have no idea what you exp[ect to happen, let alone what actually did - and we have no access to your DB, so we can't even begin to test it!

So tell us what it is doing that you didn't expect, or not doing that you did.
Tell us what you did to get it to happen.
Tell us any error messages.

Use the "Improve question" widget to edit your question and provide better information.

1 solution

While you haven't specified the exact issue in your question, it seems that based on the subject context, you aim to execute calculations at the GridView level. To accomplish this, you can employ the CellValueChanged event handler. Below is a comprehensive article that you can refer:
How To: Do Calculations in GridView[^]
Share this answer

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