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

Top 5 Contributors of the Month
Imran Ghani

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#" %>

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

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

<form runat="server">

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

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

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

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


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


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 + "'";




Further Readings:


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