在GridView控件更新获得一个文本框+所有非修饰细胞编辑? [英] On gridview updated get all modified cells in a textbox + non edited?

查看:152
本文介绍了在GridView控件更新获得一个文本框+所有非修饰细胞编辑?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在一个文本框加在细胞中修改的所有值+谁不修改其他:

 表名:信息
列:名称| SUBNAME |年龄|生日| code

我使用网格视图更新

 的for(int i = 0;我4;;我++){
如果(e.OldValues​​ [I]的ToString()!= e.NewValues​​ [I]的ToString())
{
Textbox1.text = GridView1.HeaderRow.Cells [I]。文本++ e.OldValues​​ [I]的ToString()+和+ e.NewValues​​ [I]的ToString()编辑;
}


  1. 它不工作,我想起来了,从1编辑的小区信息,如果我从一排,我得到随机小区信息编辑2格,我的意思是如果我修改名称子名称我得到的名称旧的价值和获得两个新的价值istead。

  2. 我想补充+谁不修改其他值。

感谢


解决方案

现在你是不是加入到文本框,你用它覆盖=

  Textbox1.text = GridView1.HeaderRow.Cells [I]。文本++ e.OldValues​​ [I]的ToString()+和+ e.NewValues​​ 的ToString();

试试这个:

  Textbox1.text + = GridView1.HeaderRow.Cells [I]。文本++ e.OldValues​​ [I]的ToString()+和+ e.NewValues​​编辑[I]的ToString();

改变了=的+ =

和对非编辑的值,像?

 如果(e.OldValues​​ [I]的ToString()!= e.NewValues​​ [I]的ToString())
    {
        Textbox1.text + = GridView1.HeaderRow.Cells [I]。文本++ e.OldValues​​ [I]的ToString()+和+ e.NewValues​​ [I]的ToString()编辑;
    }
    其他
    {
        Textbox2.text + = GridView1.HeaderRow.Cells [I]。文本++ e.OldValues​​ [I]的ToString()+没有改变;
    }

I'm trying to add in a textbox all values modified in cells + the others who aren't edited:

table name : info
columns : Name|Subname|Age|Birthday|Code

I'm using on grid view update

for(int i =0;i<4;i++){
if(e.OldValues[i].ToString() != e.NewValues[i].ToString())
{
Textbox1.text = GridView1.HeaderRow.Cells[i].Text + " " + e.OldValues[i].ToString() + " edited with " + e.NewValues[i].ToString();
}

  1. It's not working I'm getting information just from 1 edited cell , if I edit 2 cells from a row I get random cell information , I mean If I edit Name and Sub Name I get Name old value and new value istead of getting both.
  2. I want to add + the other values who aren't edited.

thanks

解决方案

Right now you are not "adding" to the textbox, you are overwriting it with "="

Textbox1.text = GridView1.HeaderRow.Cells[i].Text + " " + e.OldValues[i].ToString() + " edited with " + e.NewValues[i].ToString();

Try this:

Textbox1.text += GridView1.HeaderRow.Cells[i].Text + " " + e.OldValues[i].ToString() + " edited with " + e.NewValues[i].ToString();

Changed the "=" for "+=".

And for the non edited values, something like? :

    if(e.OldValues[i].ToString() != e.NewValues[i].ToString())
    {
        Textbox1.text += GridView1.HeaderRow.Cells[i].Text + " " + e.OldValues[i].ToString() + " edited with " + e.NewValues[i].ToString();
    }
    else
    {
        Textbox2.text += GridView1.HeaderRow.Cells[i].Text + " " + e.OldValues[i].ToString() + " didn't change";
    }

这篇关于在GridView控件更新获得一个文本框+所有非修饰细胞编辑?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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