D ) SCALER FUNCTION(min,max,avg,sum) , GRIDVIEW ACCESS CONTROL(foreach) , Ass :- (Qty*Cost=Total)

                      *  SCALER FUNCTION  *


 *     scaler function is similar to Sql function .(sum,min,max,avg)
 *    scaler function return only one value.

  Step :- select gridview -- goto the source -- use show footer atribute in gridview -- <Gridview  ShowFooter="true" > tag

 Code :- GridView1.FooterRow.Cells[1].Text="total amount" ; 

   Q ) How to use Scaler Function 
   code :-  string k1 = "select sum(qty)from grid";
                cm = new SqlCommand(k1, cn);
               GridView1.FooterRow.Cells[2].Text=cm.ExecuteScalar().ToString();

                                 * simple scaler function concept video *


                                         * Access Gridview Control (Foreach)

 * Access control inside the gridview using ForEach 
* Foreach is use to row object 
* Find the gridview control inside the Foreach
* All control is to be find with the help of ID.   Ex. ID="Button" ,textbox etc

Foreach    :-        foreach (GridViewRow r1 in GridView1.Rows)
                                    {

                                    }
Find Control Syntax :- ControlNAme Obj= (ControlNAme )r1.FindControl("ControlID");
 
                                             * Forach and Find control concept video *


 

                         Assignment :-- Scaler function (Qty*Cost=Total)


                    1)   deleted record on the bases of Checkbox
                 2)   2column add with alter query (cost and total)
                 3)   update quantity and total if user can click button



              
 

Comments

Popular posts from this blog

DATA CONTROL ( Gridview , Repeater , Formview , DataList , Detailsview , Listview )

Z 5 ) MVC (Model view Controller)

Z 8 ) MVC HTMLHELPER METHOD AND ACTIONLINK (how to use css ,atrributes,style in css)