Check whether you have 'return false' inside your overshowusermessage method. If there are no any 'reurn false' statement, please check the browser console and see whether there are any errors.
<asp:LinkButton runat="server" id="lnkShowUserMessageModal" class="overshow" OnClick="ShowNewMessages_Click" OnClientClick="">
</asp:LinkButton>
add this into ur page_load both will work finw..
lnkShowUserMessageModal..Attributes.Add("onclick", "javascript:overshowusermessage(event, this);")"
A.Venkatesan
Microsoft Certified Professional
Please mark the replies as answers if they help or unmark if not.
If you have any feedback about my replies, please contact venkatmca008@gmail.com
Marked as answer by Kurai on Feb 28, 2012 02:23 AM
Kurai
Member
236 Points
187 Posts
Linkbutton: OnClick versus OnClientClick
Feb 25, 2012 06:23 AM|LINK
Hi,
I have linkbutton that have onClick and OnClientClick.. OnClientClick works but not my onClick (serverside).. how can I fix this?
here's my code snippet..
thanks...
LinkButton onClick
pankajgoyal_...
Member
501 Points
166 Posts
Re: Linkbutton: OnClick versus OnClientClick
Feb 25, 2012 06:37 AM|LINK
see thread: http://forums.asp.net/t/1658230.aspx/1/10
you'll get your solution there.
LinkButton onClick
roopeshreddy
All-Star
20259 Points
3345 Posts
Re: Linkbutton: OnClick versus OnClientClick
Feb 25, 2012 08:30 AM|LINK
Hi,
In your client script, return value!
<asp:LinkButton runat="server" id="lnkShowUserMessageModal" class="overshow" OnClick="ShowNewMessages_Click" OnClientClick="javascript:return overshowusermessage(event, this);"> </asp:LinkButton> <script type="text/javascript"> function overshowusermessage(evt,ctrl) { //your code return true; } </script>Hope it helps u...
LinkButton onClick
Roopesh Reddy C
Roopesh's Space
MetalAsp.Net
All-Star
112699 Points
18359 Posts
Moderator
Re: Linkbutton: OnClick versus OnClientClick
Feb 25, 2012 08:33 AM|LINK
LinkButton onClick
Ruchira
All-Star
44171 Points
7179 Posts
MVP
Re: Linkbutton: OnClick versus OnClientClick
Feb 25, 2012 02:22 PM|LINK
Hi,
Check whether you have 'return false' inside your overshowusermessage method. If there are no any 'reurn false' statement, please check the browser console and see whether there are any errors.
My Tech blog | My YouTube ChannelPlease 'Mark as Answer' if this post helps you.srinanthuram
Contributor
6800 Points
1549 Posts
Re: Linkbutton: OnClick versus OnClientClick
Feb 25, 2012 02:39 PM|LINK
hi
pls see this url
http://forums.asp.net/t/1270958.aspx/1
thank u
Kurai
Member
236 Points
187 Posts
Re: Linkbutton: OnClick versus OnClientClick
Feb 26, 2012 12:35 AM|LINK
Hi ALL,
Here's the complete scripts....
<script type="text/javascript"> function overshowusermessage(event, obj) { ShowDialog_UserMessage(true); event.preventDefault(); return true; } </script> <script type="text/javascript"> $(document).ready(function () { $("#lnkShowUserMessageModal").click(function (e) { ShowDialog_UserMessage(true); e.preventDefault(); }); }); function ShowDialog_UserMessage(modal) { $("#overlay_usermessage").show(); $("#dialog_usermessage").fadeIn(300); $("#close").click(); if (modal) { $("#overlay_usermessage").unbind("click"); } else { $("#overlay_usermessage").click(function (e) { HideDialog_UserMessage(); }); } } function HideDialog_UserMessage() { $("#overlay_usermessage").hide(); $("#dialog_usermessage").fadeOut(300); $("#open").click(); } </script>Ruchira
All-Star
44171 Points
7179 Posts
MVP
Re: Linkbutton: OnClick versus OnClientClick
Feb 26, 2012 02:18 AM|LINK
Hi,
You have called preventDefault() method two time so that't wht it's default action getting prevented. Try by commenting out those two lines.
My Tech blog | My YouTube ChannelPlease 'Mark as Answer' if this post helps you.Smith Peter
Member
142 Points
52 Posts
Re: Linkbutton: OnClick versus OnClientClick
Feb 27, 2012 06:25 AM|LINK
Hi,
and a javscript function should return true. else OnClick won't work.
venkatmca008
Participant
1810 Points
341 Posts
Re: Linkbutton: OnClick versus OnClientClick
Feb 27, 2012 07:18 AM|LINK
hi...u just reomove ur OnClientClick
<asp:LinkButton runat="server" id="lnkShowUserMessageModal" class="overshow" OnClick="ShowNewMessages_Click" OnClientClick=""> </asp:LinkButton> add this into ur page_load both will work finw.. lnkShowUserMessageModal..Attributes.Add("onclick", "javascript:overshowusermessage(event, this);")"Microsoft Certified Professional
Please mark the replies as answers if they help or unmark if not.
If you have any feedback about my replies, please contact venkatmca008@gmail.com