Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to do this link??

Status
Not open for further replies.

sthmpsn1

MIS
Sep 26, 2001
456
US
I am working on my lovely calendar still and want to send the results in a link which opens up another browser window.

Here is my code, any suggestions?

Sub Date_selected(sender as Object,e as EventArgs)
Dim themonth as String
Dim theday as String
Dim theyear as String
themonth = Calendar2.SelectedDate.month() - 1
theday = Calendar2.SelectedDate.day()
theyear = Calendar2.SelectedDate.year()

Response.Redirect(" & yourid.text & "/calendar/?cmd=new&mm=" & themonth & "&dd=" & theday & "&yy=" & theyear & "")

End Sub
 
Write a javascript function that takes in YourID, Month, Day, Year parameters, then use a
window.open("urlhere") call. Build the url and pass it to the window.open function.

D
 
Try registering a javascript in your Date_selected sub to open the new window.

Dim Script As New StringBuilder()
Script.Append(&quot;<script language='javascript'>&quot;)
Script.Append(&quot;window.open(url, other parameters);&quot;)
Script.Append(&quot;</script>&quot;)
RegisterStartupScript(&quot;openWindow&quot;, Script.ToString())
 
Try adding a '0' attribute to your Redirect method. Something like:

Response.Redirect(&quot; & yourid.text & &quot;/calendar/?cmd=new&mm=&quot; & themonth & &quot;&dd=&quot; & theday & &quot;&yy=&quot; & theyear & &quot;&quot; , 0 )
NetAngel
 
using the code above which creates a javascript I get an error Compiler Error Message: BC30648: String constants must end with a double quote

for this line. Line 192: Script.Append(&quot;</script>&quot;)

I tried writing it like this Script.Append( & &quot;</script>&quot;)
but that doesn't seem to work. I am not using code behind feature so I know that has something to do with it.

Sub Date_selected(sender as Object,e as EventArgs)
Dim themonth as String
Dim theday as String
Dim theyear as String
themonth = Calendar2.SelectedDate.month() - 1
theday = Calendar2.SelectedDate.day()
theyear = Calendar2.SelectedDate.year()

Dim Script As New StringBuilder()
Script.Append(&quot;<script language='javascript'>&quot;)
Script.Append(&quot;window.open( & yourid.text & &quot;/calendar/?cmd=new&mm=&quot; & themonth & &quot;&dd=&quot; & theday & &quot;&yy=&quot; & theyear & &quot;&quot;)
Script.Append(&quot;</script>&quot;)
RegisterStartupScript(&quot;openWindow&quot;, Script.ToString())



End Sub
 
well I fixed that using this

Dim Script As New StringBuilder()
Script.Append(&quot;<script language='javascript'>&quot;)
Script.Append(&quot;window.open( & yourid.text & &quot;/calendar/?cmd=new&mm=&quot; & themonth & &quot;&dd=&quot; & theday & &quot;&yy=&quot; & theyear & &quot;)&quot;)
Script.Append( &quot;<&quot;& &quot;/script>&quot;)
RegisterStartupScript(&quot;openWindow&quot;, Script.ToString())


but now I get an actual javascript error saying there is an expected')' error now.
 
I was just missing the ' quotes

Script.Append(&quot;window.open(' & yourid.text & &quot;/calendar/?cmd=new&mm=&quot; & themonth & &quot;&dd=&quot; & theday & &quot;&yy=&quot; & theyear & &quot;')&quot;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top