Reputation: 1931
<asp:PlaceHolder runat="server" ID="phShowMonsterSourceFacet" EnableViewState="true">
<div class="oneSearchFilter">
<div>
<div class="filterItem chkMonsJobs">
<asp:CheckBox ID="chkMonsJobs" runat="server" AutoPostBack="true" Checked="true" EnableViewState="true" ViewStateMode="Enabled" OnCheckedChanged="ChkMonsJobs_CheckedChanged" CssClass="MNSColumnTextViewMore" />
</div>
</div>
</div>
</asp:PlaceHolder>
public event EventHandler RefineSearchtrivoxMonsJobCheckBoxChecked;
protected void ChkMonsJobs_CheckedChanged(object sender, EventArgs e)
{
if (RefineSearchtrivoxMonsJobCheckBoxChecked != null)
{
RefineSearchtrivoxMonsJobCheckBoxChecked(this, EventArgs.Empty);
}
}
check box event is triggered only when check box is unchecked the other way is not working..
Upvotes: 0
Views: 455
Reputation: 73721
In order to get the behavior that you report, I had to set :
EnableViewState="false"
at the page level (or on a container of the CheckBox). If you set:
EnableViewState="true"
everywhere, it works for both check and uncheck actions.
An even simpler solution is to remove all EnableViewState and ViewStateMode attributes from your markup and use the default values.
UPDATE
If you want to disable the ViewState at the page level and enable it for individual controls, you can set this at the page level:
ViewStateMode="Disabled"
And this for each control that needs the ViewState:
ViewStateMode="Enabled"
In that case, you should not use EnableViewState in the markup, since using both attributes can make things more confusing...
Upvotes: 1