this is in c# vs2003, web forms
i have this dgv and which is populated by some database values i have one column called price and i want to get the total of that column to a local veriable can some one tell me how to do it
kalpa23 0 Light Poster
Recommended Answers
Jump to Postuse a for loop for that, u ll get the total in a local variable...
Jump to Postaddie20,
I couldn't get your question, what should happen with your grid dynamically..?
Jump to Postam sry, i forgot to add a condition between., find the proper code below...
dtDisp_changed = objBusiness.Display_Inv_dtl(invoiceNoTextEdit.Text.Trim());
if(dtDisp_changed.Rows.Count > 0)
{
for (int i = 0; i < dtDisp_changed.Rows.Count; i++)
{
if(i == 0)
sum = Convert.ToDecimal(dtDisp_changed.Rows[0]["AMT"]);if(i>0)
sum = sum + Convert.ToDecimal(dtDisp_changed.Rows["AMT"]);
}
}MessageBox.Show(Convert.ToString(sum));
…
All 10 Replies
arunkumars 14 Junior Poster
nick.crane 342 Veteran Poster
addie20 0 Newbie Poster
arunkumars 14 Junior Poster
arunkumars 14 Junior Poster
hirenpatel53 -1 Posting Whiz in Training
arunkumars 14 Junior Poster
arunkumars 14 Junior Poster
Lusiphur commented: Good examples, shame about the missing [CODE] tags :) +1
Darpan Singh 0 Newbie Poster
arunkumars 14 Junior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.