Asp.net 如何根据条件显示文本

Asp.net 如何根据条件显示文本,asp.net,vb.net,gridview,Asp.net,Vb.net,Gridview,如何解决该问题,如果CID匹配且第三列为Y,则显示链接和文本。如果CID匹配且第三列为N,则不显示任何内容。假设第二张图片用于CID=57,则首先执行其他图片,单元格获取空值,然后执行第二列,链接连接到一个先前清除的空值。要解决所有这些问题,只需使用elseif: 假设第二张图片用于cid=57,则首先执行else,单元格获取空值,然后执行第二张图片,链接连接到一个先前已清除的空值。要解决所有这些问题,只需使用elseif: 如果在e.Row.Cells3.Text中满足Y条件,则只需在单元格中

如何解决该问题,如果CID匹配且第三列为Y,则显示链接和文本。如果CID匹配且第三列为N,则不显示任何内容。

假设第二张图片用于CID=57,则首先执行其他图片,单元格获取空值,然后执行第二列,链接连接到一个先前清除的空值。要解决所有这些问题,只需使用elseif:


假设第二张图片用于cid=57,则首先执行else,单元格获取空值,然后执行第二张图片,链接连接到一个先前已清除的空值。要解决所有这些问题,只需使用elseif:


如果在e.Row.Cells3.Text中满足Y条件,则只需在单元格中附加链接

案例陈述可能是你最好的选择,因为你没有复杂的if-elseif条件,所以更容易阅读

If Request("cid") = 15 And e.Row.Cells(3).Text = "Y" Then   'Hudson Health Plan
    e.Row.Cells(11).Text = "<A href='http://myintra1/checkfile.aspx?id=90' target='_blank'>Click here for participating providers and the provider participating location/s.  </a> <br/>" & e.Row.Cells(11).Text
Elseif Request("cid") = 57 And e.Row.Cells(3).Text = "Y" Then   'Health Plus Amerigroup/Empire BCBS
    e.Row.Cells(11).Text = "<A href='http://myintra1/checkfile.aspx?id=23' target='_blank'>Click here for participating providers and the provider participating location/s.  </a> <br/>" & e.Row.Cells(11).Text
Else
    e.Row.Cells(11).Text = ""
End If

如果在e.Row.Cells3.Text中满足Y条件,则只需在单元格中附加链接

案例陈述可能是你最好的选择,因为你没有复杂的if-elseif条件,所以更容易阅读

If Request("cid") = 15 And e.Row.Cells(3).Text = "Y" Then   'Hudson Health Plan
    e.Row.Cells(11).Text = "<A href='http://myintra1/checkfile.aspx?id=90' target='_blank'>Click here for participating providers and the provider participating location/s.  </a> <br/>" & e.Row.Cells(11).Text
Elseif Request("cid") = 57 And e.Row.Cells(3).Text = "Y" Then   'Health Plus Amerigroup/Empire BCBS
    e.Row.Cells(11).Text = "<A href='http://myintra1/checkfile.aspx?id=23' target='_blank'>Click here for participating providers and the provider participating location/s.  </a> <br/>" & e.Row.Cells(11).Text
Else
    e.Row.Cells(11).Text = ""
End If
If Request("cid") = 15 And e.Row.Cells(3).Text = "Y" Then   'Hudson Health Plan
    e.Row.Cells(11).Text = "<A href='http://myintra1/checkfile.aspx?id=90' target='_blank'>Click here for participating providers and the provider participating location/s.  </a> <br/>" & e.Row.Cells(11).Text
Elseif Request("cid") = 57 And e.Row.Cells(3).Text = "Y" Then   'Health Plus Amerigroup/Empire BCBS
    e.Row.Cells(11).Text = "<A href='http://myintra1/checkfile.aspx?id=23' target='_blank'>Click here for participating providers and the provider participating location/s.  </a> <br/>" & e.Row.Cells(11).Text
Else
    e.Row.Cells(11).Text = ""
End If
If e.Row.Cells(3).Text = "Y" Then 

    Select case Request("cid")

        case 15
            e.Row.Cells(11).Text = "CID = 15 link " & e.Row.Cells(11).Text
        case 57
            e.Row.Cells(11).Text = "CID = 57 link " & e.Row.Cells(11).Text
        case else
            e.Row.Cells(11).Text = ""
    End Select

End If