Link to home
Start Free TrialLog in
Avatar of Hojoformo

asked on

Question about OnCheckedChanged event

I have questions about events in ASP.NET.  I added an event "OnCheckedChanged" that does not get triggered until a Button event is initiated.  Is there any way to trigger the "OnCheckedChanged" event immediately when the checkbox is selected like a client side event?  For example, when the checkbox is selected, then call server method CheckBox1_CheckedChanged.  

<asp:CheckBox ID="CheckBox1" runat="server" OnCheckedChanged="CheckBox1_CheckedChanged" />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click1" Text="Button" /></div>

public void CheckBox1_CheckedChanged(object sender, EventArgs e)
        DateTime todaysdate = DateTime.Now;
        TextBox2.Text = todaysdate.ToString();
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

For server-side events, you would need a post-back in order to fire the CheckedChanged event.  If you want to have it happen immediately, without a post-back, then you need to handle that client side with Javascript.

Avatar of ryandale56

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial