Gridview页脚行添加 [英] Gridview Footer row adding

查看:68
本文介绍了Gridview页脚行添加的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友,
我有一个Gridview,它绑定了表中的所有相应值(天,借方,贷方,余额).
我只想添加一个页脚行,其中可以包含所有借方&信用额.
Gridview:Autogeneratecolumns为true;

所以告诉我什么是合适的代码.

Hi Friends,
I have a Gridview , that bind all the respective value(day, debit, credit, balance) from the table.
I just want to add a footer row that can have some of all debit & credit amount.
Gridview:Autogeneratecolumns is true;

so tell me what should be the approprite code to do it.

<asp:GridView ID="gdview" runat="server"  CssClass="p"

              style="top: -13px; left: 2px; position: relative; height: 964px; width: 703px" 

              AllowPaging="True" GridLines="None" 

              onpageindexchanged="gdview_PageIndexChanged" 

              onpageindexchanging="gdview_PageIndexChanging" ShowFooter="True" 

              Font-Names="Courier New" Font-Size="Small" PageSize="50" 

                    onrowdatabound="gdview_RowDataBound">
         
              
         
          <pagersettings pagebuttoncount="4" mode="NextPrevious" nextpagetext="Next">
                    PreviousPageText="Pre" />
          <pagerstyle font-underline="True" forecolor="Black" horizontalalign="Justify" />
   
  <columns>
  <asp:TemplateField>
  <footertemplate>
<asp:Label ID="lbl_fdebit" runat="server" Text='<%#"$"+Eval("Debit") %>'>
  </footertemplate>
  
  </columns></pagersettings>





private void binddata()
    {
       
        string st = "D";
        con = new SqlConnection(constr);
        cmd = new SqlCommand("SELECT  datepart(" + st + ", date) as day1, CheckNO, Narration, COD, Debit, Credit, Balance FROM  IOB_Stmt1 WHERE (Date between '" +  Session["fordate"].ToString() + "' and '" + Session["todate"].ToString() + "')", con);
        da = new SqlDataAdapter(cmd);
        ds = new DataSet();
        da.Fill(ds, "Emp");
        //return ds.Tables[0];
        gdview.DataSource = ds;
        gdview.DataBind();
        gdview.Visible = true;

        DataTable dt = ds.Tables["Emp"];
        Session["datatable"] = dt;
        //gridbind();
        //gdv.DataSource = ds;
        //gdv.DataBind();
 }

推荐答案

" + Eval( )%>' < /footertemplate > < /列 > < /pagersettings >
"+Eval("Debit") %>'> </footertemplate> </columns></pagersettings>





private void binddata()
    {
       
        string st = "D";
        con = new SqlConnection(constr);
        cmd = new SqlCommand("SELECT  datepart(" + st + ", date) as day1, CheckNO, Narration, COD, Debit, Credit, Balance FROM  IOB_Stmt1 WHERE (Date between '" +  Session["fordate"].ToString() + "' and '" + Session["todate"].ToString() + "')", con);
        da = new SqlDataAdapter(cmd);
        ds = new DataSet();
        da.Fill(ds, "Emp");
        //return ds.Tables[0];
        gdview.DataSource = ds;
        gdview.DataBind();
        gdview.Visible = true;

        DataTable dt = ds.Tables["Emp"];
        Session["datatable"] = dt;
        //gridbind();
        //gdv.DataSource = ds;
        //gdv.DataBind();
 }


面板"概念将有助于解决此问题.
"Panel" concept will help to solve this problem.


您好,Vimdream,

阅读以下文章.

希望对您有帮助

http://msdn.microsoft.com/en-us/library/bb310552.aspx [ ^ ]
Hi Vimdream,

Go through the following article.

Hope it helps

http://msdn.microsoft.com/en-us/library/bb310552.aspx[^]


这篇关于Gridview页脚行添加的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆