如何在HTML标签中破坏if条件 [英] How to witre a if condition in HTML Tags

查看:110
本文介绍了如何在HTML标签中破坏if条件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有这样的代码.在下面的代码中,我要编写要显示的条件的用户名
如果UserType为Admin,则为uSerName.为此,我该如何编写.默认情况下,它将显示我要隐藏其他用户名的所有用户的所有字段(期望usertype ="admini")

I have code like this. In below code The UserName I want to write a condtion i want to show
the uSerName if UserType is Admin.For that how can I write. By Default it will show all fields for all user I want to hid username for other (expect usertype="admini")

<tr>
                  <th>
                      Name

                  </th>

                  <th>
                      User Name
                  </th>

                  <th>
                      Email
                  </th>
                  <th>
                      Contact Details
                  </th>

              </tr>

推荐答案

已将其标记为ASP.NET,因此可以使用GridView将数据绑定到该数据,而无需手动创建网格.然后,使用绑定事件,可以根据需要设置行或控件的可见性.这样做有很多示例,您只需要查找它们即可.
You have tagged this as ASP.NET so you could use a GridView to bind you data to it rather than creating a grid by hand. Then using the binding events you can set the visibility of rows or controls as necessary. There are many examples of doing this, you just need to look for them.


您可以将GridView用于相同的功能,
严格来说,您只想编写HTML,然后才可以使用代码来显示和隐藏用户名.
You can use GridView for the same ,
Strictly you want to write HTML , code only then you can use JavaScript to Show and hide User Name.


HTML是一种标记语言,而不是编程语言,因此没有逻辑
结构.

但是,如果您使用.Net进行开发,则可以将内联脚本嵌入到
该页面为:
HTML is a Markup Language, not a programming language, so has no logic
structures.

If you are developing in .Net, however, you can embed inline scripting on
the page as:
<% if (m_GlobalVariable == "2") %>

 <% { %>

   <tr valign="top">

       <td align="right">My Condition1 :</td>

    </tr>

<% } %>


<%%>标签是实际代码的去向.
希望对您有帮助


The <% %> tags are where your actual code will go.
hope this helps


这篇关于如何在HTML标签中破坏if条件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆