Recently I changed the style of some controls in my ASPX page at runtime based on the values set on another control in my page. For example the color of the table is changed based on the radio button that was selected and the color of the button is changed according to the text that was typed in the textbox. Hope this is helpful.
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head runat="server">
- <title>Changing the Control Style</title>
- <style type="text/css">
- .Style1
- {
- background-color: Red;
- }
- .Style2
- {
- background-color: Blue;
- }
- </style>
- </head>
- <body>
- <form id="form1" runat="server">
- <asp:RadioButton ID="RadioButton1" runat="server" Text="Red" GroupName="1" Checked="True" AutoPostBack="True" />
- <asp:RadioButton ID="RadioButton2" runat="server" Text="Blue" GroupName="1" AutoPostBack="True" />
- <!-- Styling the table based on the radio button selection. -->
- <table class="<% if(RadioButton1.Checked) { %> Style1 <% } else { %> Style2 <% } %>">
- <tr>
- <td> See the change... </td>
- </tr>
- <tr>
- <td> </td>
- </tr>
- </table>
- <asp:TextBox ID="TextBox1" runat="server" MaxLength="3"></asp:TextBox>
- <!-- Styling the button based on the textbox value. -->
- <input id="Button1" type="submit" value="button"
- class="<% if(TextBox1.Text=="") { %> Style1 <% } else { %> Style2 <% } %>" />
- </form>
- </body>
- </html>
-
Output looks as below.
3 comments:
hello arjunachith.blogspot.com admin found your site via search engine but it was hard to find and I see you could have more visitors because there are not so many comments yet. I have found site which offer to dramatically increase traffic to your blog http://xrumerservice.org they claim they managed to get close to 1000 visitors/day using their services you could also get lot more targeted traffic from search engines as you have now. I used their services and got significantly more visitors to my website. Hope this helps :) They offer improve pagerank seo ranking backlink service backlinks google Take care. Jay
Thanks for the suggestion Jay, BTW are you the Jay that I used to work with about 5 years back.
Arjuna.
Can anybody point to some blog posts on this board subject? I want some more detailed info...
Any input will definitely be gratefully appreciated.
Alex
http://www.primechoiceautoparts.com
Cheers!
Post a Comment