Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > '<%#Server.UrlEncode("Events_View.aspx") %>' returns ''

Reply
Thread Tools

'<%#Server.UrlEncode("Events_View.aspx") %>' returns ''

 
 
AAaron123
Guest
Posts: n/a
 
      03-23-2009
I've learned a lot in this NG recently. I learned about <%# and about
UrlEncode but apparently not quite enough.

I want to open the page Events_View.aspx when a button is clicked, so I
tried:

<input type="button" value="Return to Event"
onclick="window.location='<%#Server.UrlEncode("Eve nts_View.aspx") %>'" />

Debugging show that the resulting markup is:

<input type="button" value="Return to Event" onclick="window.location=''" />

Can you see what is wrong with my statement?

Also reading about window.location I don't see the difference between:

window.location="EventsView.aspx")

and

window.location.href="EventsView.aspx")

Is there a difference?



Thanks




 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      03-24-2009
<%# %> is a binding expression. you probably are not calling databind.

window.location is an object (browser, not javascript) with properties.
but if set to a string url, the new object is created and navigation is
performed.

-- bruce (sqlwork.com)

AAaron123 wrote:
> I've learned a lot in this NG recently. I learned about <%# and about
> UrlEncode but apparently not quite enough.
>
> I want to open the page Events_View.aspx when a button is clicked, so I
> tried:
>
> <input type="button" value="Return to Event"
> onclick="window.location='<%#Server.UrlEncode("Eve nts_View.aspx") %>'" />
>
> Debugging show that the resulting markup is:
>
> <input type="button" value="Return to Event" onclick="window.location=''" />
>
> Can you see what is wrong with my statement?
>
> Also reading about window.location I don't see the difference between:
>
> window.location="EventsView.aspx")
>
> and
>
> window.location.href="EventsView.aspx")
>
> Is there a difference?
>
>
>
> Thanks
>
>
>
>

 
Reply With Quote
 
 
 
 
AAaron123
Guest
Posts: n/a
 
      03-24-2009
I hope this fixes the difference between
<%= and <%# in my mind.



"bruce barker" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> <%# %> is a binding expression. you probably are not calling databind.
>

I hope this fixes the constructs
<%= and <%# in my mind.




> window.location is an object (browser, not javascript) with properties.
> but if set to a string url, the new object is created and navigation is
> performed.
>

Setting the href property does the same thing?
They seem to work indentically in this instance.

Thanks

>
> -- bruce (sqlwork.com)
>
> AAaron123 wrote:
>> I've learned a lot in this NG recently. I learned about <%# and about
>> UrlEncode but apparently not quite enough.
>>
>> I want to open the page Events_View.aspx when a button is clicked, so I
>> tried:
>>
>> <input type="button" value="Return to Event"
>> onclick="window.location='<%#Server.UrlEncode("Eve nts_View.aspx") %>'" />
>>
>> Debugging show that the resulting markup is:
>>
>> <input type="button" value="Return to Event" onclick="window.location=''"
>> />
>>
>> Can you see what is wrong with my statement?
>>
>> Also reading about window.location I don't see the difference between:
>>
>> window.location="EventsView.aspx")
>>
>> and
>>
>> window.location.href="EventsView.aspx")
>>
>> Is there a difference?
>>
>>
>>
>> Thanks
>>
>>
>>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorted Returns List and Reversed Returns Iterator ++imanshu Python 7 08-23-2008 04:25 AM
Hash#select returns an array but Hash#reject returns a hash... Srijayanth Sridhar Ruby 19 07-02-2008 12:49 PM
createImage sometime returns null and sometime returns non-null. vizlab Java 3 10-17-2007 11:21 AM
block returns and hash element returns Trans Ruby 2 11-06-2005 12:15 PM
Device search returns devices with zero length strings =?Utf-8?B?U3RlcGhlbiBJbmtwZW4=?= Wireless Networking 2 07-15-2005 12:26 AM



Advertisments