如何用DataGrid实现多行数据的同时更新呀?我现在正在写一个程序,需要同时更新多行记录的值 ,我应该如何实现呀!希望高手能过来帮帮小妹!谢了!
解决方案 »
- GridView模板列的问题
- 关于Application的run和exit,理解不能
- 网站保存用户的问题
- WPF中 数据绑定时单击【确定】再修改,如何实现?
- WF设计器标题如何修改
- silverlight中可以调用C++编写的dll么?
- vs2003项目转到vs2005的问题
- 如何用C#打开WINDOWS自带的计算器?
- 关于Dotfuscator Community Edition的一点困惑
- 请教大家一个关于Newtonsoft.Json的小问题
- c#下用什么将字符串(整型数或者浮点数 字符串)转化为数字?
- winform中listbox控件如何对任意行添加text、value值以及取值?(任意行)
this.DataGrid.DataSource = DataSet.Tables[0].DefaultView;
this.DataGrid.DataBind();
public void MyDataGrid_ItemCommand(object source,System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
string err;
if (e.CommandName == "Add")
{
foreach (DataGridItem di in MyDataGrid.Items)
{
if (di.ItemType==ListItemType.Item || di.ItemType == ListItemType.AlternatingItem )
{
string sQTY;
double dQTY;
string sCategory=this.dlstCategory.SelectedItem.Text.Trim ();
sQTY=((TextBox)e.Item.FindControl("edit_st_QTY")).Text;
sQTY =((TextBox)di.FindControl("txtQTY")).Text.Trim();
if (sQTY =="")
sQTY = "0";
try
{
dQTY=Convert.ToDouble(sQTY);
}
catch
{
err = "数量类型错误 !";
goto error;
}
if (dQTY > 0 )
{
Account myAccount = Account.MyAccount;
Stock acct = new Stock (nIntCode,dQTY,sStatus,myAccount.userId);
err = acct.AddNew();
if (err != "")
goto error;
}
}