有一个用户表,我其中有5列,我只是对其中用户名和密码加密了,现在我想把用户这一列读取出来,并绑定到datagrid中显示。可是不知道该怎么做。
我有一个想法是在数据读取到DataSet中的时候每行解密,可是又没办法做到。现在有点不知道怎么做了,求救各位了。

解决方案 »

  1.   

    可以在datagrid前臺用模板列,然后放入Label控件,顯示Text時調用解密方法
      

  2.   

    前臺:
    <asp:TemplateColumn HeaderText="用戶名">
    <ItemTemplate>
    <asp:Label id=Label6 runat="server" Text='<%# GetJM(DataBinder.Eval(Container.DataItem, "username")) %>'>
    </asp:Label>
    </ItemTemplate>
    </asp:TemplateColumn>
    后臺:
    //下面是你的解密方法
    public string GetJM(string strValue)
    {
      
    }
      

  3.   

    我说的也是web的,哈哈
    我先试试。