Click here to Skip to main content
15,887,746 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
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")

XML
<tr>
                  <th>
                      Name

                  </th>

                  <th>
                      User Name
                  </th>

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

              </tr>
Posted
Updated 28-Mar-12 2:56am
v3

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.
 
Share this answer
 
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.
 
Share this answer
 
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:
XML
<% 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
 
Share this answer
 
Comments
[no name] 28-Mar-12 9:00am    
If you are developing on .NET then using classic ASP methods are unnecessary and outdated.
[no name] 29-Mar-12 0:38am    
Thanks Bro. Got what i am looking for Keep Helping Others
member60 18-May-12 0:53am    
welcome

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900