We've expanded our news coverage and improved our search! Visit
oreilly.com for the latest or search for all things across O'Reilly!
Article:
 |
|
Enhancing ASP.NET Pages with JavaScript
|
| Subject: |
|
Frame Navigation |
| Date: |
|
2004-07-30 11:52:07 |
| From: |
|
SamCranford
|
|
|
|
You can also use ASP.NET data binding to change the src of a frame, like this
In script block or code behind:
Public contentUrl as string = "main.aspx"
Private Sub Page_Load(<args not included)
If WhateverTest = True Then
contentUrl = "here.aspx"
End If
DataBind()
End Sub
In the html:
<frame src="<%# contentUrl %>" id="MainContent" name="MainContent" frameborder=no />
It works better than the Javascript redirect, which I was using before. It cause the default page to flash quickly before the redirect. It also caused the default page to perform all of its processing for nothing.
Thanks,
Sam
|