Jump to content
Sign in to follow this  
rhishi20

page postback while opening new window through javascript

Recommended Posts

I have Two gridviews on single ASPX page. after clicking linkbutton on 1st gridview second grid will display. and on that grid, I have another linkbutton which will open a new window using javascript.

 

my problem is, after opening new window my aspx page does postback which I don't want. so I decided to use

return false in javascript function

 

Javascript Function

-------------------------

function show_windowResCAdetails(deptname) {
var url1;
var complaintno = document.getElementById("HiddenField2").value;
url1 = "viewResCallActionDetails.aspx?deptname=" + deptname +"&complaintno=" +complaintno
vWincal1 = window.open(url1, "Responsible_CallActions",
"width=730,height=350,status=no,resizable=yes,top=230,left=175,scrollbars=1");
return false;
}
Design Page(Template inside Gridview)
--------------------------------------------------
<asp:TemplateField HeaderText="Dept Name">
<ItemTemplate>
<asp:LinkButton ID="lnkResDept" Text='<%#bind("deptnm")%>' OnClick="lnkResdept_Click" OnClientClick='<%#"show_windowResCAdetails(""" + Eval("deptnm") + """);return false;"%>' runat="server"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
here you can see that I have used return false two times in javascript function as well as on inline design.
when i have tried to remove any of the return false; then aspx page will remain doing postback.
but when i use both my problem solves.
i don't understand how it is working.
regards,
Rhishikesh
Edited by rhishi20

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...