Search This Blog

Monday, November 1, 2010

How can put condition in aspx page

<table width="100%" border="0" cellpadding="0" cellspacing="0">
                    <tr>
                    <% if (Convert.ToInt16(Request["ID"]) == 4)
                       {%>

                   
                      <td  height="42" valign="middle" class="greyred"><a href="index.aspx?ID=4">Promotions</a></td>
                      <% } if (Convert.ToInt16(Request["ID"]) == 1 || Convert.ToInt16(Request["ID"]) == 2 || Convert.ToInt16(Request["ID"]) == 3 || Convert.ToInt16(Request["ID"]) == 5 )
                         { %>
                      <td  height="42" valign="middle" class="grey"><a href="index.aspx?ID=4" >Promotions</a></td>
                      <%}
                        else if (Convert.ToInt16(Request["ID"]) != 4)
                        {%>
                         
                       <td height="42" bgcolor="#e5e5e5" class="greyred"><a href="index.aspx?ID=4">Promotions</a></td>
                       <%}%>
                    </tr>
                    <tr>
                      <td bgcolor="#e5e5e5"><img src="images/dot.jpg" width="213" height="1" /></td>
                    </tr>
                    <tr>
                     <% if(Convert.ToInt16(Request["ID"]) == 1) {%>                       <td height="42" bgcolor="#e5e5e5" class="greyred"><a href="index.aspx?ID=1">New Arrivals </a></td>
                     <% } else { %>
                      <td height="42" bgcolor="#e5e5e5" class="grey"><a href="index.aspx?ID=1">New Arrivals </a></td>
                       <%}%>
                    </tr>
                    <tr>
                      <td bgcolor="#e5e5e5"><img src="images/dot.jpg" width="213" height="1" /></td>
                    </tr>
                    <tr>
                     <% if(Convert.ToInt16(Request["ID"]) == 2) {%>
                      <td height="42" bgcolor="#e5e5e5" class="greyred"><a href="index.aspx?ID=2">Best Sellers </a></td>
                     <% } else { %>
                      <td height="42" bgcolor="#e5e5e5" class="grey"><a href="index.aspx?ID=2">Best Sellers </a></td>
                     <%}%>
                    </tr>
                    <tr>
                      <td bgcolor="#e5e5e5"><img src="images/dot.jpg" width="213" height="1" /></td>
                    </tr>
                    <tr>
                     <% if(Convert.ToInt16(Request["ID"]) == 3) {%>
                      <td height="42" bgcolor="#e5e5e5" class="greyred"><a href="index.aspx?ID=3">Coming Soon </a></td>
                    <% } else { %>
                      <td height="42" bgcolor="#e5e5e5" class="grey"><a href="index.aspx?ID=3">Coming Soon </a></td>
                         <%}%>
                    </tr>
                    <tr>
                      <td bgcolor="#e5e5e5"><img src="images/dot.jpg" width="213" height="1" /></td>
                    </tr>
                    <tr>
                    <% if(Convert.ToInt16(Request["ID"]) == 5) {%>
                      <td height="42" bgcolor="#e5e5e5" class="greyred"><a href="index.aspx?ID=5">Offers</a></td>
                      <% } else { %>
                       <td height="42" bgcolor="#e5e5e5" class="grey"><a href="index.aspx?ID=5">Offers</a></td>
                            <%}%>
                    </tr>
                </table>

1 comment :

Sapphire Solutions said...

How can put condition in aspx page

Good post...!

asp.net developers will find this post interesting...

Well, we are here to share our blog-

Top 10 Important Development Tools For .NET To Try Out Today

Development Tools For .NET

What is WordPress? 5 Benefits of using WordPress

Benefits of using WordPress