check box click server side event not working once validation summary is displayed
-
Hi all I have a user control with textbox fields to enter the address. If the fields are empty, the validation summary will be displayed. There is one checkbox on the control to fill up the text boxes if it is checked in. When the validation summary is available on the page, and I click on the checkbox, to automatically fill the text boxes, it does not work. Server side event is not getting fired when I check and uncheck the checkbox for the first time when validation summary is available on page. I added, client side to event to CheckBox and then called __doPostBack event from the javascript. But postback is not happening. I have following javascript
function OnCheckClick()
{
__doPostBack('SameAddressCheckBox','');}
When I used the above script on "onclick" event of checkbox, after validation summary appears on page, when I try to check in the checkbox, validation summary goes away, but the checkbox is not getting checked in and server side event is also not called. can anyone please suggest some thing so that postback can happen and will call serverside event. Many thanks.
-
Hi all I have a user control with textbox fields to enter the address. If the fields are empty, the validation summary will be displayed. There is one checkbox on the control to fill up the text boxes if it is checked in. When the validation summary is available on the page, and I click on the checkbox, to automatically fill the text boxes, it does not work. Server side event is not getting fired when I check and uncheck the checkbox for the first time when validation summary is available on page. I added, client side to event to CheckBox and then called __doPostBack event from the javascript. But postback is not happening. I have following javascript
function OnCheckClick()
{
__doPostBack('SameAddressCheckBox','');}
When I used the above script on "onclick" event of checkbox, after validation summary appears on page, when I try to check in the checkbox, validation summary goes away, but the checkbox is not getting checked in and server side event is also not called. can anyone please suggest some thing so that postback can happen and will call serverside event. Many thanks.
you do not need javascript in this case CheckBox has properties AutoPostBack and OnCheckChanged. in your ASPX something like <asp:CheckBox runat="server" ID="chkTest" AutoPostBack="true" OnCheckedChanged="chkTest_OnCheckedChanged" /> in your ASPX.cs something like protected void chkTest_OnCheckedChanged(Object sender, EventArgs e) { if (chkText.Checked) { // your code } else { // your code } } Good Luck