T
TarTar
I have two buttons on my ASP.NET 2.0 form:
<asp:Button id="btnSubmit" Text="Submit" OnClick="btnSubmit_Click"
CausesValidation="true" runat="server"></asp:Button>
<asp:Button id="btnCancel" Text="Cancel" OnClick="btnCancel_Click"
CausesValidation="false" runat="server"></asp:Button>
The following HTML code is generated:
<input type="submit" name="btnSubmit" value="Update"
onclick="javascript:WebForm_DoPostBackWithOptions(new
WebForm_PostBackOptions("btnSubmit", "", true,
"", "", false, false))" id="btnSubmit" />
<input type="submit" name="btnCancel" value="Cancel" id="btnCancel" />
Why the onclick event handler is called for the first button that has
CausesValidation="true", but not for the other one that has
CausesValidation="false"? The CausesValidation property should not have any
influence on the event handler. Yet when I set CausesValidation="true" for
the second button - the onclick event is called.
Thanks,
Leszek
<asp:Button id="btnSubmit" Text="Submit" OnClick="btnSubmit_Click"
CausesValidation="true" runat="server"></asp:Button>
<asp:Button id="btnCancel" Text="Cancel" OnClick="btnCancel_Click"
CausesValidation="false" runat="server"></asp:Button>
The following HTML code is generated:
<input type="submit" name="btnSubmit" value="Update"
onclick="javascript:WebForm_DoPostBackWithOptions(new
WebForm_PostBackOptions("btnSubmit", "", true,
"", "", false, false))" id="btnSubmit" />
<input type="submit" name="btnCancel" value="Cancel" id="btnCancel" />
Why the onclick event handler is called for the first button that has
CausesValidation="true", but not for the other one that has
CausesValidation="false"? The CausesValidation property should not have any
influence on the event handler. Yet when I set CausesValidation="true" for
the second button - the onclick event is called.
Thanks,
Leszek