I've been hacking and googling for a while now, I guess it's time to ask the experts.
I have a link in my gridview that when clicked should open a popup window. I want scrollbars, a menubar and it should be sizable. So this is what I have. It is not working. You click the link and nothing happens.
I had so many darn IE windows open that I didn't see that my popup window was opening.
However, the main thing I am trying to accomplish is to get the scrollbars and I do not have them. It is sizable and I have the menubar but I don't have scrollbars. My grid is overlapping off the window and I have to maximize to see it but that's still not all of it.
Thank you for the reply. I thought I was doing that. Did you scroll my code all the way over to the right? I'm not sure what you're suggesting that's different from what I am already doing. Thanks.
popUp was in my javascript. I did as riteshjain1982suggested and am using open.window instead. It works but there's still no scrollbars. Plus this odd behavior: On the page where I clicked in the gridview, that page loses all its contents and displays the word [object] instead. That's it for the whole page. (I believe this was happeninig with popUp also).
I hope this isn't another weird problem I'm so good at getting myself into...
Does clicking on the link causing the page to postback.
Are you setting the NavigateURL property in onRowDataBound event? I guess, you are not. I think you are setting this property in Page Load event wrapped inside IsPostBack check.
You are right: I am not setting it in RowDataBound.
You are wrong: I am not setting it in PageLoad.
I hope you are not sorry you asked: I have filters on my page where the user can say what kind of records he wants to see in the grid. So let's say he says he wants to see all records with a customer name like "truck". He fills that info out then hits a submit button. Here's my code from then on:
Code:
Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
PopulateGrid()
End Sub
Sub PopulateGrid()
Dim ds As New DataSet
GetDataForGrid(ds) ' Gets data according to filters user selected
Me.GridView1.DataSource = ds
Try
Me.GridView1.DataBind()
' Row-by-row of the grid, process each column...
Dim idxData As Integer
Dim idxGrid As Integer = 0
For idxData = Me.GridView1.PageSize * Me.GridView1.PageIndex _
To Me.GridView1.PageSize * (Me.GridView1.PageIndex + 1) - 1
Dim hyEstTotal As HyperLink = DirectCast(Me.GridView1.Rows(idxGrid).FindControl("hyEstTotal"), HyperLink)
hyEstTotal.NavigateUrl = _
"javascript:window.open('show_details.aspx?inv_hdr_ik=" + CStr(ds.Tables(0).Rows(idxData).Item("inv_hdr_ik")) + "', 'DETAILS', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=1,resizable=1,location=0,width=800,height=600');"
If idxData >= (ds.Tables(0).Rows.Count - 1) Then Exit For
idxGrid += 1
Next
The reason you get the [object] displayed is when you click on the link, the page is attempting to 'go to' what the href is telling it to go to. The href is calling some javascript. window.open() returns a value that is a javascript "object". Browser sees that and displays it.
The only assumption I can make is that this has something to do with browser settings. Try this in another browser. Try setting a smaller height and width. Try a temporary URL like vbforums.com or mendhak.com
Thanks for the suggestions. I was also thinking of trying the same code with another of my pages that I want to open in the same manner. Will let you know how it turns out...
The only one of mendhak's suggestions I couldn't try, was to code a url such as www.vbforums.com in my link because my code looked for it inside its own folder structure. None of the other suggestion revealed anything (Firefox, surprisingly, was worse and even the parts of the non-scrollable window that worked in IE7 didn't work in Firefox).
This page is in production so I really need it to scroll. I don't know what else to try.
I substituted the old asp page for my new aspx page and it is opening with scrollbars. I am certain now it is in the page I am going to...I just have to find out why.
In an effort to protect my company's secrets I edited the instruction and I think I deleted the single quote and misled you. So this is the truth, the whole truth, blah blah blah:
I promise you, the first one has scroll bars. When I comment out the first way and try the second, there are no scroll bars. It must be show_inv_details_estimate.aspx. It is full of gridviews and they are off the bottom of the page. Do I have to put them all in a panel?
When I was googling, I saw sample code that instead of saying =1 or =0 just said the name of what they wanted and if it was zero left the name off, know what I mean? So to get scrollbars it was just "scrollbars" and if they didn't want scrollbars they just left that keyword out. It was something I tried that made no difference.
Are you making whatever attempt you can on my behalf so I don't have to redesign the page with a panel? Or you don't think panels are what I need?
Markup (hope you're not sorry you asked...it's long, hence the need for scrollbars!): Oops - it made my post exceed the mask. I've attached it.
Regarding panels...when I googled asp.net and scrollbars, the first few hits all said something about putting your controls on a panel and scrolling the panel.
If I were you, I wouldn't have posted until Monday and told me you worked on it all weekend long! You could've given me an asp file back and told me to replace mine, and I don't think I ever would've noticed the one-line change! But I wouldn't have learned anything either.
If I weren't so happy I'd feel very stupid. Thanks. My appreciation is in no way proportionate to how long it took you to find it (well, I'm not forgetting there were like 28 posts in this thread that you read through!)