Can I use dojotype and onServerClick at the same time?
I tried using onserverclick while having dojotype in my button.
See this code.
<button id="ButtonLogin" runat="server" onServerClick="ButtonLogin_OnClick" dojotype="dijit.form.Button" jsid="ButtonLogin" style="float: right;
padding: 5px 15px 0px 0px;">
Login</button>
So basically I have an empty ButtonLogin_OnClick that will fire after the button is clicked (something warning). and also dojotype runs javascript as well (also warns Something).
<script runat="server">
void ButtonLogin_OnClick(object sender, EventArgs e)
{
//alert
}
</script>
How I test it. Only the doyotite succeeded.
Can anyone explain this to me or can we use both at the same time?
source to share
While it may not be directly about dojotype, this example might help you. I am using the following to call javascript then asp.net to submit.
<asp:Button ID="btnSubmit" runat="server" Text="Send" OnClick="btnSubmit_Click" onclientclick="javascript:alert('A');" />
You can check if the page is valid before javascript execution
<asp:Button ID="btnSubmit" runat="server" Text="Send" OnClick="btnSubmit_Click" onclientclick="javascript:Page_ClientValidate();if(Page_IsValid){ //Do stuff };" />
source to share
You can't have both! Basically, dojo and asp.net are trying to replace the onClick handler, so you won't see both being executed.
The best solution is to add your reverse logic to the dojo click handler:
<button id="ButtonLogin" runat="server"
dojotype="dijit.form.Button" jsid="ButtonLogin"
style="float: right;padding: 5px 15px 0px 0px;">
Login
<script type="dojo/method" data-dojo-event="onClick" data-dojo-args="evt">
__doPostBack('ButtonLogin','');
</script>
</button>
dd
source to share
I think there is a problem in the syntax, the click event is not executed and the function is not a call instead of "onServerClick", you can try "onserverclick". Maybe this will solve your problem ...
Try this code
<button id="ButtonLogin" runat="server" onserverclick="ButtonLogin_OnClick" dojotype="dijit.form.Button" jsid="ButtonLogin" style="float: right;
padding: 5px 15px 0px 0px;">Login</button>
otherwise you can call ButtonLogin_OnClick function on the Dojo click event, this will result in the shared event together ...
source to share