How can I make a Textbox a mandatory field if a checkbox is checked on a button click event in the client side?

<asp:TextBox id=’TextBox1′ style=’Z-INDEX: 101; LEFT: 32px; POSITION: absolute; TOP: 104px’ runat=’server’></asp:TextBox> <asp:CheckBox id=’CheckBox1′ style=’Z-INDEX: 102; LEFT: 24px; POSITION: absolute; TOP: 80px’ runat=’server’></asp:CheckBox> <asp:Button id=’Button1′ style=’Z-INDEX: 103; LEFT: 32px; POSITION: absolute; TOP: 144px’ runat=’server’ Text=’Button’></asp:Button> <script> function func1() { if(document.getElementById (‘CheckBox1’).checked == true) { if(document.getElementById(‘TextBox1’).value == ”) { alert(‘Enter something in textbox’); } } } </script> VB.NET Button1.Attributes.Add (‘onclick’ , ‘return func1()’); C# Button1.Attributes.Add (‘onclick’ , ‘return func1()’);

How to disable a Dropdownlist once someone has selected an item in the Dropdownlist

<asp:DropDownList id=’DropDownList1′ runat=’server’> <asp:ListItem Value=’Red’>Red</asp:ListItem> <asp:ListItem Value=’Blue’>Blue</asp:ListItem> <asp:ListItem Value=’Green’>Green</asp:ListItem> </asp:DropDownList> VB.NET DropDownList1.Attributes.Add(‘onChange’,’this.disabled=true;’ ) C# DropDownList1.Attributes.Add(‘onChange’,’this.disabled=true;’ );

How to change the BackgroundColor of a page based on the value selected in a DropdownList

<asp:DropDownList id=’DropDownList1′ runat=’server’ AutoPostBack=’True’> <asp:ListItem Value=’Red’>Red</asp:ListItem> <asp:ListItem Value=’Blue’>Blue</asp:ListItem> <asp:ListItem Value=’Green’>Green</asp:ListItem> </asp:DropDownList> VB.NET Page.RegisterClientScriptBlock(‘BodyStyle’, ‘<style type=’text/css’>body{background-color: ‘ + DropDownList1.SelectedItem.Value + ‘;}</style>’) C# Page.RegisterClientScriptBlock(‘BodyStyle’, ‘<style type=’text/css’>body{background-color: ‘ + DropDownList1.SelectedItem.Value + ‘;}</style>’);