liorbrauer:
I know how to get the mouse coordinates in javascript, but I am clueless as to how to this in asp.net
There's no difference. You still need to use javascript to get the coordinates.
I have a asp:button control and an OnClick event which is ofcourse in .net and not the javascript onclick event. How do I call a javascript function through the .net event?
You add a javascript onclick event to the button. This can be done in a couple of ways: add OnClientClick within the declarative markup for the button - <asp:Button ID="Button1" runat="server" OnClientClick="getCoords()"... />, or Button1.Attributes.Add("Onclick", "getCoords()")
Great! Thanks! that really helped me, and I have another question now:
I want to send an identifier of the button itself to a function. I tried:
<asp:LinkButton ID="LinkButton1" runat="server" OnClick="LinkButton1_Click" OnClientClick="positionDialog(this)">myButton</asp:LinkButton>
but for some reason that doesn't work. What am I doing wrong?
EDIT:
I found out, i used this.id
but that was no good for me. I have a Panel control under the button, and I want to send the identifier of the PANEL to a function when the button is clicked (all in JS), but I am not sure how. The thing is, this whole thing is part of a UserControl that is used several times in the same page, so each instance of the Panel in the UserControl has a different id in the HTML output (Journal1_Panel1, Jounral2_Panel1, etc.)
Any ideas?
If you have another question, you should start another appropriately titled thread. If the panel is the parent container to the button, then this.parentNode.id should reference it.
No comments:
Post a Comment