Thursday 25 October 2012

how to retrieve data from database in asp.net using c#

For this, just follow some simple steps which is given bellow.
  1. Open Visual studio, goto file --> click New Web site --> select lcocation --> select C# as your language..
  2. Open Default.aspx and Drag Gridview from ToolBar menu (Standard Control)
  3. Or copy bellow code on to your .aspx form between <DIV></DIV> tag.

Monday 11 June 2012

how to calculate sum of gridview columns in .net

Here, we are going to calculate the total value of a perticular column in GridView1.



As you can see in above fig.. there is QUANTITY, RATE, AMOUNT columns are there..
Suppose we have a requirement where we want to calculate the total number QUANTITY for BE No.- BOE-1.
For that reason, i have written bellow code in ASP.NET(C#)

decimal a=0, b=0;   // declaring variable
for (int i = 0; i < (gridview1.Rows.Count); i++)     //Counting total number of rows in GridView1
{

    a = Convert.ToDecimal(gridview1.Rows[i].Cells[7].Text.ToString());
    b = b + a; //storing total qty into variable

}

Note-
1)  Convert.ToDecimal(gridview1.Rows[i].Cells[7].Text.ToString()); //here i have given "Rows[i].Cells[7].Text" Becouse, i want to sum quantity and its index is  7.

http://www.codeproject.com/Questions/271994/how-to-calculate-sum-of-gridview-columns-in-net

Thursday 1 March 2012

Me and MySelf

"My name is Vikas Shukla and I am a Sofware Developer from Mumbai, Maharastra. I live with my family. I graduated in 2010 with a bachelor's degree in Information Technology and Diploma in .NET Application from the Mumbai University.I have been in the field for nearly 2 years, and have been loving every minute of it. I am a blogger, entrepreneur, designer, developer, and overall thinker.