Peter Chan
asked on
Event not fired
Dear,
I do not know why event cannot be fired below, after having clicked the button.
I do not know why event cannot be fired below, after having clicked the button.
<input type="submit" name="LoginButton" value="登录" id="LoginButton" class="LoginButton" onclick="LoginButton_Click" style="font-weight: bold; position:fixed; top:30%;left:50%; z-index:1000"/>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I do not use
<asp:button ...
due to that I want to put style to it. And AutoEventWireup is not available to this "<input ..." line.
I do not use
why?
<asp:button id="LoginButton" runat="server" style="...you can add style here..." cssClass="your_button_class_here" ...>
then
LoginButton_click(...)
will be automatically fired!
Check if the LoginButton_Click() function is defined in the global context.If not then you can do the following:
window.LoginButton_Click=function(){
//your code here...
};
Obviously the wired event is a server side event, so you should use <asp:Button....> instead of the normal input, and for the styling, why don't you wrap all the these css rules into a proper class and just assign it to the button using the CssClass attribute.
You can also assign the style attribute to an asp server control using jQuery or plain JavaScript , you will just have to assign an ID to the button and set ClientIDMode="Static".
If you insist for some reason to use html control, you can submit your form via ajax.
You can also assign the style attribute to an asp server control using jQuery or plain JavaScript , you will just have to assign an ID to the button and set ClientIDMode="Static".
If you insist for some reason to use html control, you can submit your form via ajax.
if this is a client side, you should use
onclick="LoginButton_Click