我用GridView顺利显示数据,同时我也实现了编辑和删除
因为涉及到密码的md5加密,所以我想在点击"编辑"后更新的同时,将密码明文通过md5加密以后再存到数据库中
请问怎么实现

解决方案 »

  1.   

    在rowupdating里面对值加密再保存呗
      

  2.   

    public static string getMD5(string str, int code)
        {        if (code == 16) //16位加密
            {
                return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str, "MD5").ToLower().Substring(8, 16);
            }        else if (code == 32) //32位加密
            {
                return System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str, "MD5");
            }
            return "0";
        } 
      

  3.   

    我只在删除里面加了一个确认删除的js
    就是不知道这个MD5怎么加
      

  4.   


    在编辑事件里加密,然后存数据库
    楼主是用DataAdapter和DataSet更新?不用单个取值?
      

  5.   

    LS,我直接用的是gridview显示的数据,并通过附带的编辑和删除来操作
      

  6.   

    string str_pwd = this.txtpwd.Text.Trim();
    string str_pwdMD5 = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(str_pwd, "MD5").ToString();//加密后
    然后把str_pwdMD5 插入数据库即可
      

  7.   

    lz 在msdn 了解 GuidView 的 RowCommand、RowEditing 事件吧,把你要加密的操作放在2个事件之一即可。(注意结合上下文操作)
      

  8.   

    在你的gridview_updating事件里加上不就行了?这个和删除有什么关系?
      

  9.   

    在Gridview的UpDating事件里写字符加密,再更新数据库就可以了啊
      

  10.   

    LZ应该是使用SQlDataSource来绑定的,基本上没有写代码
    还是手写下好,更更好理解gridview