.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> ASP.NET Controls >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

On checkbox changed event

Posted By:santhiyagu       Posted Date: April 28, 2011    Points: 40    Category: ASP.NET Controls    URL: http://www.dotnetspark.com  

HTML tag for checkbox changed event in asp.net
 


<%@Page Language="C#" %>
<html>

Web Form </FONT><FONT color=#ff6100>'Ch</FONT><FONT color=#000000>ange</FONT><FONT color=#ff6100>' a</FONT><FONT color=#000000>nd </FONT><FONT color=#ff6100>'Cl</FONT><FONT color=#000000>ick</FONT><FONT color=#ff6100>' E</FONT><FONT color=#000000>vents

<body>
class="heading">Web Form 'Change' and 'Click' Events


<form runat="server">

"MyText" text="OriginalValue"
     ontextchanged="MyChangeCode" runat="server" />  

"MyListBox"
     onselectedindexchanged="MyChangeCode" runat="server">
  "Option 1" value="Value1" runat="server" />
  "Option 2" value="Value2" runat="server" />
  "Option 3" value="Value3" runat="server" />
  

"MyCheckBox"
     oncheckedchanged="MyChangeCode" runat="server" />  

"MySubmitButton" text="Submit"
     onclick="MyClickCode" runat="server" />  

form>

"divResult" runat="server" enableviewstate="false" />
class="cite">Change the values in the controls and click 'Submit'div>

"server">

void MyChangeCode(object objSender, EventArgs objArgs) {
  Control ctrSender = (Control)objSender;
  divResult.InnerHtml += "Change event detected for control '"
                      + ctrSender.ID + "'";
}

void MyClickCode(object objSender, EventArgs objArgs) {
  Control ctrSender = (Control)objSender;
  divResult.InnerHtml += "Click event detected for control '"
                      + ctrSender.ID + "'";
}


body>
html>

           


     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend