Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/visual-studio-2010/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Asp.net Obout栅格:仅为特定行在栅格上隐藏图像_Asp.net_Obout - Fatal编程技术网

Asp.net Obout栅格:仅为特定行在栅格上隐藏图像

Asp.net Obout栅格:仅为特定行在栅格上隐藏图像,asp.net,obout,Asp.net,Obout,将obout栅格与以下列一起使用: <obg:Column ID="Image" DataField="" HeaderText="" Width="50" runat="server"> <TemplateSettings TemplateId="ImageTemplate" /> </obg:Column> 但它并没有隐藏图像。如何仅对某些行使用obout网格以编程方式隐藏图像?感谢您。如果您在将来遇到此问题时找到了答案: protected vo

将obout栅格与以下列一起使用:

<obg:Column ID="Image" DataField="" HeaderText="" Width="50" runat="server">
   <TemplateSettings TemplateId="ImageTemplate" />
</obg:Column>

但它并没有隐藏图像。如何仅对某些行使用obout网格以编程方式隐藏图像?感谢您。如果您在将来遇到此问题时找到了答案:

protected void grd_RowDataBound(object sender, GridRowEventArgs e)
{
  // Check if this is a DataRow
  if (e.Row.RowType == GridRowType.DataRow)
  {
    // Check if we are hiding the image
    if (testpassed())
    {            
      // Retrieve Image Cell (Column 2 in my case)
      GridDataControlFieldCell cell = e.Row.Cells[1] as GridDataControlFieldCell;

      // Retrieve Literal Control with Image Source Html (Found at Level 5)
      LiteralControl imgTag = cell.Controls[0].Controls[0].Controls[0].Controls[0].Controls[0] as LiteralControl;

      // Remove Html <img src.. code from Literal Control in order to hide image
      imgTag.Text = "";
    }
  }
}
protectedvoid grd_RowDataBound(对象发送方,GridRowEventArgs e)
{
//检查这是否是数据行
如果(e.Row.RowType==GridRowType.DataRow)
{
//检查我们是否隐藏了图像
if(testpassed())
{            
//检索图像单元格(在我的示例中为第2列)
GridDataControlFieldCell=e.Row.Cells[1]作为GridDataControlFieldCell;
//使用图像源Html检索文本控件(在级别5处找到)
LiteralControl imgTag=cell.Controls[0]。Controls[0]。Controls[0]。Controls[0]。Controls[0]作为LiteralControl;
//删除Html
protected void grd_RowDataBound(object sender, GridRowEventArgs e)
{
    if (testpassed())
    {
        e.Row.Cells[1].Text = "";  // Column 2 is the image
    }
}
protected void grd_RowDataBound(object sender, GridRowEventArgs e)
{
  // Check if this is a DataRow
  if (e.Row.RowType == GridRowType.DataRow)
  {
    // Check if we are hiding the image
    if (testpassed())
    {            
      // Retrieve Image Cell (Column 2 in my case)
      GridDataControlFieldCell cell = e.Row.Cells[1] as GridDataControlFieldCell;

      // Retrieve Literal Control with Image Source Html (Found at Level 5)
      LiteralControl imgTag = cell.Controls[0].Controls[0].Controls[0].Controls[0].Controls[0] as LiteralControl;

      // Remove Html <img src.. code from Literal Control in order to hide image
      imgTag.Text = "";
    }
  }
}