Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 showdialogbox problem

Author  Topic 

juicyapple
Posting Yak Master

176 Posts

Posted - 2008-06-09 : 01:32:34
Hi,

I have a datagrid with a hyperlink column. In itemdatabound event, I set the navigateurl of the hyperlink. Using the javascript:window.showModalDialog will encounter problem "Access is denied", but the second one works fine (the commented code). Anyone has idea pls share with me. Thanks.


Protected Sub dg1_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles dg1.ItemDataBound

If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType = ListItemType.AlternatingItem Then

hlink.NavigateUrl = "javascript:window.showModalDialog('..\..\OnlineSys\AttachFile.aspx','resizable:yes;scroll:yes;dialogHeight:600 px;dialogWidth:900 px');"

'this is OK.
'hlink.NavigateUrl = "..\..\OnlineSys\AttachFile.aspx"

end if

end sub

ayamas
Aged Yak Warrior

552 Posts

Posted - 2008-06-09 : 02:55:26
I also had encountered this problem some time back.It got resolved when I wrote a seperate javascript function.
Try this
1)Your javascript code

function openwindow(url)
{
window.open(url);
}

2)In the datagrid Itemdatabound you can write like this.

hlink.NavigateUrl="javascript:openwindow('http://please write the whole path of the page')"
Go to Top of Page
   

- Advertisement -