Tuesday, October 21, 2014

gridview bind in asp.net

Posted by Unknown  |  No comments


 if you want more related search please click here  
 please help to other  
 http://scriptquery.blogspot.in/  

 <asp:GridView ID="GridView1" runat="server">  
      <Columns>  
         <asp:BoundField DataField="tran_date" HeaderText="Transaction Date"  
           SortExpression="tran_date" />  
         <asp:BoundField DataField="RSQ" HeaderText="Transaction Cash"  
           SortExpression="RSQ" />  
         <asp:BoundField DataField="RSU" HeaderText="Cash Unit"  
           SortExpression="RSU" />  
         <asp:BoundField DataField="CSQ" HeaderText="Credit sale"  
           SortExpression="CSQ" />  
         <asp:BoundField DataField="CSU" HeaderText="Credit Unit"  
           SortExpression="CSU" />  
            <asp:BoundField DataField="iAmount" HeaderText="Amount"  
           SortExpression="iAmount" />  
       </Columns>  
     </asp:GridView>  
 public void fillgrid()  
   {  
     conns();  
     SqlConnection con=new SqlConnection (conn);  
     SqlCommand com;  
     try  
     {  
       con.Open();  
       com = new SqlCommand("usp_Dailysales_main", con);  
       com.CommandType = CommandType.StoredProcedure;  
       com.Parameters.AddWithValue("@FrmDate", DateTime.Parse(rdpFrom.SelectedDate.Value.ToString("yyyy/MM/dd"), CultureInfo.CreateSpecificCulture("en-CA")));  
       com.Parameters.AddWithValue("@todate", DateTime.Parse(rdpTo.SelectedDate.Value.ToString("yyyy/MM/dd"), CultureInfo.CreateSpecificCulture("en-CA")));  
       //com.Parameters.AddWithValue("@strfltr", strfltr1);  
       //  com.Parameters.AddWithValue("@sptype", ddlsreturn.SelectedValue);  
       com.Parameters.AddWithValue("@ch", Int32.Parse(Convert.ToString(ViewState["ch"])));  
       SqlDataAdapter da = new SqlDataAdapter(com);  
       DataTable dt = new DataTable();  
       da.Fill(dt);  
       GridView1.DataSource = dt;  
       GridView1.DataBind();  
     }  
     catch (Exception ex)  
     {  
     }  
   }  

 if you want more related search please click here  
 please help to other  
 http://scriptquery.blogspot.in/  


7:15 AM Share:

0 comments:

Get updates in your email box
Complete the form below, and we'll send you the best coupons.

Deliver via FeedBurner
Proudly Powered by Blogger.
back to top