Protected Sub GridView1_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
Dim gvr As GridViewRow = CType(e.Row, GridViewRow)
If (e.Row.RowType = DataControlRowType.DataRow) Then
Dim LinkButton1 As LinkButton = CType(gvr.FindControl("SendEmail"), LinkButton)
LinkButton1.Attributes.Add("onclick", "javascript:NewOpenPopUp('" & DataBinder.Eval(e.Row.DataItem, "Company_RecID") & "');")
End If
End Sub
The problem is that when I click on the link button, it opens two windows Popup.aspx (in IE). In firefox and chrome the clicking opens only one window.
Exactly we will need source which is generated in browser in which it is working. I agree with that. Can you please provide it so that we can check which property/attribute is not working for IE
At first glance I don't see anything way wrong. I'm wondering if IE's internal popup-blocker is preventing your new window from opening. Can you go to IE and under the tools menu check internet options and then check the privacy tab and make sure that
turn on pop-blocker is not checked, or click the settings button and make sure the site you're working on is added to the list of allowed sites for pop-ups. If memory serves you can also hold the ctrl key down when clicking a link in IE and it will by pass
the popup blocker if it's turned on.
Just a thought but lets start with the easy stuff before we dive too deep into code.
The problem is in IE, its opening two windows of the same aspx which is undesirable. In Firefox and Chrome, it opens one window which is what I want from IE as well.
I wonder if the Link button's postback effect is somehow causing the event to fire twice. I wouldn't think it would but that's what it sounds like. Is there some other code you're trying to execute along with the linkbutton aside from opening your new
windows?
If you're not trying to execute some other code that requires a postback on the page, is it possible to just use asp:HypyerLink instead of asp:LinkButton?
I agree with Loganix77. In order to resolve your issue, please check your code and see whether there is something which opens a new windows. It would be better if you debug your code step by step which can help you out.
If it doesn't resolve your issue, please try to simply your project and upload it to skydrive. That will help us to continue.
Best wishes,
Please mark the replies as answers if they help or unmark if not.
Feedback to us
Kinley
Member
13 Points
7 Posts
Link button New Window
Apr 27, 2012 01:10 PM|LINK
Hello,
I am facing a weird problem specific to IE. On Chrome and Firefox, it works absolutely fine.
Aim is to open a new window by clicking on the link button (which is inside gridview).
So, I have these 3 things:
a) Java script function
function NewOpenPopUp(Company_RecID) { var theForm = document.forms['form1']; theForm.method = "POST"; var popurl = 'Popup.aspx?Company_RecID=' + Company_RecID theForm.action = popurl; theForm.target = "_blank"; theForm.submit(); }b) The link button on the aspx page
c) The codebehind
Protected Sub GridView1_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound Dim gvr As GridViewRow = CType(e.Row, GridViewRow) If (e.Row.RowType = DataControlRowType.DataRow) Then Dim LinkButton1 As LinkButton = CType(gvr.FindControl("SendEmail"), LinkButton) LinkButton1.Attributes.Add("onclick", "javascript:NewOpenPopUp('" & DataBinder.Eval(e.Row.DataItem, "Company_RecID") & "');") End If End SubThe problem is that when I click on the link button, it opens two windows Popup.aspx (in IE). In firefox and chrome the clicking opens only one window.
Just wondering why this behavior from IE?
Thanks
ronin47
Member
62 Points
73 Posts
Re: Link button New Window
Apr 27, 2012 01:21 PM|LINK
Can you post the HTML-Code which was generated in IE and FFox?
chiragtoad
Member
212 Points
51 Posts
Re: Link button New Window
Apr 27, 2012 01:24 PM|LINK
Exactly we will need source which is generated in browser in which it is working. I agree with that. Can you please provide it so that we can check which property/attribute is not working for IE
Kinley
Member
13 Points
7 Posts
Re: Link button New Window
Apr 27, 2012 01:30 PM|LINK
Hi,
Thanks for the reply. Actually the html generated is pretty huge. Is there any specific part you want?
I just compared the source generated by IE and Firefox and they are exactly the same.
Also, there are no errors when I check the Firefox error console for any javascript errors.
Thanks
Loganix77
Participant
1351 Points
412 Posts
Re: Link button New Window
Apr 27, 2012 01:30 PM|LINK
At first glance I don't see anything way wrong. I'm wondering if IE's internal popup-blocker is preventing your new window from opening. Can you go to IE and under the tools menu check internet options and then check the privacy tab and make sure that turn on pop-blocker is not checked, or click the settings button and make sure the site you're working on is added to the list of allowed sites for pop-ups. If memory serves you can also hold the ctrl key down when clicking a link in IE and it will by pass the popup blocker if it's turned on.
Just a thought but lets start with the easy stuff before we dive too deep into code.
ronin47
Member
62 Points
73 Posts
Re: Link button New Window
Apr 27, 2012 01:37 PM|LINK
I agree, please also make sure that JavaScript isn't blocked.
Kinley
Member
13 Points
7 Posts
Re: Link button New Window
Apr 27, 2012 01:37 PM|LINK
Hi,
The problem is in IE, its opening two windows of the same aspx which is undesirable. In Firefox and Chrome, it opens one window which is what I want from IE as well.
Thanks.
ronin47
Member
62 Points
73 Posts
Re: Link button New Window
Apr 27, 2012 01:42 PM|LINK
ok then pls post the generated code or at least that part where your popups are beeing opened
Loganix77
Participant
1351 Points
412 Posts
Re: Link button New Window
Apr 27, 2012 02:00 PM|LINK
I wonder if the Link button's postback effect is somehow causing the event to fire twice. I wouldn't think it would but that's what it sounds like. Is there some other code you're trying to execute along with the linkbutton aside from opening your new windows?
If you're not trying to execute some other code that requires a postback on the page, is it possible to just use asp:HypyerLink instead of asp:LinkButton?
Catherine Sh...
All-Star
23382 Points
2490 Posts
Microsoft
Re: Link button New Window
May 04, 2012 02:42 AM|LINK
Hi Kinley,
I agree with Loganix77. In order to resolve your issue, please check your code and see whether there is something which opens a new windows. It would be better if you debug your code step by step which can help you out.
If it doesn't resolve your issue, please try to simply your project and upload it to skydrive. That will help us to continue.
Best wishes,
Feedback to us
Develop and promote your apps in Windows Store