I Use Visual Studio 2005 In My Project,Today I Find Some Problem.
in my sql server 2005 database,there have a field(bit),i use the controls DetailsView,for show the Detail info.
because the type bit's value true or false,but i can not to show true or false,i want to show the lock or unlock,here is the resolvent.

note 1 ---use sql.
this is the code:"select userlock=(case when userlock=0 then 'lock' else 'unlock' end)" form tablename";

note 2 --- use databound
    protected void DetailsView1_DataBound(object sender, EventArgs e)
    {
        Label LabTemp = (Label)DetailsView1.FindControl("Label1");
        if (LabTemp.Text == "True")
        {
            LabTemp.Text = "lock";
        }
        else
        {
            LabTemp.Text = "unlock";
        }
    }
上面第二条解决方法,必须将该列转化成模板列才行,否则是没办法改变显示的。

相关文章:

  • 2021-06-28
  • 2022-01-07
  • 2021-07-18
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-31
  • 2021-08-29
猜你喜欢
  • 2022-01-26
  • 2022-01-12
  • 2022-02-22
  • 2022-12-23
  • 2021-11-19
  • 2022-02-01
  • 2022-12-23
相关资源
相似解决方案