单击按钮时Gridview的总行数 [英] Sum rows of Gridview on button click

查看:91
本文介绍了单击按钮时Gridview的总行数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含3列说明",金额"和类型"的gridview,并且我在gridview之外有两个按钮,即编辑"和更新".当Gridview第一次在数量"列中加载数据时,是一个标签,但是当它们单击编辑"时,数量"列中的所有标签都变为文本框,用户可以编辑数量.当用户单击更新按钮时,如何在updatebtn_click事件中验证金额列是否为零?

Hi, i have a gridview with 3 columns "description", "amount" and "type" and i have two buttons outside the gridview, "edit" and "update". When the gridview first loads the data in the amount column is a label but when they click "edit", all the labels in the amount column change to textboxes and the user can edit the amounts. When the user clicks the update button how can i validate that the amount column balances to zero, in the updatebtn_click event?

推荐答案

以下内容将帮助您设计如何在网格中具有编辑/更新功能:
在GridView中就地编辑 [在ASP.NET 2.0中可编辑GridView [ ^ ]


对于验证的最后一部分,请执行以下步骤:
1.为您的更新按钮定义OnClientClick
2. OnClientClick的方法将随调用一起传递行号
3.在JavaScript方法中,获取有关行的数据,然后验证总和
4.根据需要显示警报.
5.取消更新或让控件移至服务器以进行更新.

试试吧!
Following will help you in designing on how to have edit/update feature in grid:
Inplace Edit in GridView[^]
Editable GridView in ASP.NET 2.0[^]


For your last part of validation, steps:
1. Define OnClientClick for your update button
2. Method for OnClientClick will pass on the rownumber along with the call
3. In JavaScript method, get the data for the row in question and then validate the sum
4. Show the alert as per your need.
5. Cancel the update or let the control move on to server for update.

Try!


这篇关于单击按钮时Gridview的总行数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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