Jump to content

page postback while opening new window through javascript


rhishi20

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
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...