就是在人员这个页面中的 gridview 里有一个按钮,一点这个按钮这个人的密码就自动初始为1
要求在web.config里实现.
这个我是一点不会,希望大家能帮助我.谢谢!

解决方案 »

  1.   

    web.config里面实现?哥们,这只是一个配置文件阿!是不是你领导说数据库连接字符串在web.config中啊
      

  2.   

    他是这么说了一嘴,那要是不在web.config里实现该怎么实现啊,我都要急死了
      

  3.   

    不用在WEB.CONFIG中設定
    那個按鈕的功能是重設密碼且設為1吧,要當即更新舊密碼嗎?
      

  4.   

    你用的是Asp.net2.0吧?是的话看下面:
    Membership Element
    其中的enablePasswordReset属性是配置密码重设的,而调用MembershipUser.ResetPassword (String)方法可以为用户重设密码。
      

  5.   

    这个比较简单,要把那个按钮的commandAar...那个属性和,你的用户id绑定
    在cs文件里,id=e.commandAry..得到,
    然后update xxtable set password=1 where xxid=id;
      

  6.   

    是在web.config里设默认值,是用一个按钮把密码读取web.config里的默认值,也就是把密码改成web.config里的默认值,再把密码进行加密
    怎么从web.config里边读取值啊?
      

  7.   

    这个我现在会了,但是不知道gridview 的我一点这个ImageButton 怎么把这个行的ID值取到啊?
      

  8.   


    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
                    // "changePwd"是ImageButton列名
    if (e.CommandName == "changePwd")
    {
    // 获取对应行
    int index = Convert.ToInt32(e.CommandArgument);
    GridViewRow row = GridView1.Rows[index]; id = Convert.ToInt32(GridView1.DataKeys[index].Value);                        // .......
    }
    }
      

  9.   

    gridview.rows[行值].cells[id所在的列].text
      

  10.   

    不行用8楼的方法在 int index = Convert.ToInt32(e.CommandArgument);
    这行报错说
    输入的string 不能转换格式
      

  11.   

    web.config里边基本上什么都可实现啊?!
      

  12.   

    web.config我也不会。
    不过也可以把按钮的属性command设置为update,然后再根据主键值把密码设为1
      

  13.   

    正确答案:先在Web.Config里加一个这个
     <add key="defaultPassWord" value="situs111"></add>再在 protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
            {
                switch(e.CommandName )
                {
                    case "Reset":
                        GridView1.SelectedIndex = int.Parse(e.CommandArgument.ToString());
                        int keyValue = int.Parse(GridView1.DataKeys[0].Value.ToString());
                        string password = ConfigurationManager.AppSettings["defaultPassWord"].ToString();();                  
      int result = emp.UpdateEmp(password, keyValue);
                        break;
                }            
            }