本文介绍了Datagridview作为在计费项目中创建账单的模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi Experts

我正在开发计费软件.我需要使用datagridview创建帐单.
1.它将具有诸如项目编号,费率,数量,总计,总计之类的字段.账单将随后在数据库中更新.

我该如何使用datagridview.

2.我希望速率和数量一填满,总计(即速率*数量)应出现在该行的合计字段中,最后的合计总额将自动更新.


问候
Yogesh

Hi Experts

I am developing a billing software. What i need is to use datagridview to create a bill.
1. It will have fields like item no ,rate , qty , total, grand total. the bill will then be updated in database.

How can i do this with datagridview.

2. i want that as soon as rate and qty is filled total(i.e rate * qty) should appear in the total field on that line and grand total at the end be updated automatically.


Regards
Yogesh

推荐答案

protected void gridClientList_RowDataBound(object sender, GridViewRowEventArgs e)
       {
           try
           {
               if (e.Row.RowType == DataControlRowType.DataRow)
               {
                   Label lblTotal = (Label)e.Row.FindControl("lblTotal");
                   lblTotal.Text = (DataBinder.Eval(e.Row.DataItem, "Rate")) * (DataBinder.Eval(e.Row.DataItem, "qly"));
               }
           }
           catch{}
      }



其中lblTotal是总计"标签的ID.



where lblTotal is the id of the Total label .



这篇关于Datagridview作为在计费项目中创建账单的模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-29 23:12