Michael Kniskern
Michael Kniskern

Reputation: 25270

asp:UpdatePanel with an ASP.NET checkbox trigger

What is the EventName property when I set up a ASP.NET checkbox control as an async postback trigger for an asp.net update panel?

Upvotes: 5

Views: 15736

Answers (3)

achinda99
achinda99

Reputation: 5078

OnCheckedChanged is the event name. You can autogenerate the method by double clicking the checkbox in the UI, and based on the checkbox name it will generate the method which will most likely be:

protected void CheckBox1_OnCheckedChanged(object sender, EventArgs e) {}

Upvotes: 1

Josh Mein
Josh Mein

Reputation: 28645

All you have to do is set AutoPostback to true and if your CheckBox is within the UpdatePanel you shouldnt have any problems

<asp:CheckBox runat="server" ID="chk_Name" AutoPostBack="true" OnCheckedChanged="chk_Name_OnCheckedChanged"></asp:CheckBox>

Then in the OnCheckedChanged function you can do whatever you need to do

protected void chk_Name_OnCheckedChanged(object sender, EventArgs e) 
{
     // Do stuff here
}

Upvotes: 6

Jakob Christensen
Jakob Christensen

Reputation: 14956

I believe it is CheckedChanged.

Upvotes: 10

Related Questions