2009-06-30 71 views

回答

1

一种方式显示的值是像这样:

<asp:CheckBox ID="CheckBox1" runat="server" 
Checked='<%# (((String)DataBinder.Eval(Container.DataItem, "Status")) == "O")?true:false %>' /> 

,然后你必须在代码背后的控制,如:

protected void gvFiles_RowDataBound(object sender, GridViewRowEventArgs e) 
{ 
    if (e.Row.RowType == DataControlRowType.DataRow) 
    { 
     if (DataBinder.Eval(e.Row.DataItem, "LastUser").ToString() == "x") 
     { 
      TextBox txtId = gvFiles.FindControl("txtId") as TextBox; 
      txtId.Text = "NA"; 
     } 
    } 

} 
相关问题