Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - Newbie - Help with a string

Reply
 
Old 06-02-2009   #1 (permalink)
Joey Martin


 
 

Newbie - Help with a string


I am just trying to populate a HYPERLINK section and instead and it
linking to another window, I want to use javascript to open a window and
set a window size.

The first one just shows Click here and opens a windows. Perfect, except
I want to write some database results.

THIS WORKS
NavigateUrl="javascript:window.open('123.html',null, 'height=200,
width=400, status=yes, toolbar=no, menubar=no, location=no');
void('');"> click here</asp:HyperLink>


THIS DOES WORK ALSO-Note that I know have real text populating using
EVAL (KEYWORD LABEL).

NavigateUrl="javascript:window.open('123.html?catKeywords=',null,
'height=200, width=400, status=yes, toolbar=no, menubar=no,
location=no'); void('');"><%# Eval("KeywordLabel") %></asp:HyperLink>

THIS DOES NOT WORK. I want to write more variables that are passed into
the popup window.<%# Eval("KeywordLabel") %>

NavigateUrl="javascript:window.open('popsearch.asp?catKeywords=<%#
Eval("KeywordLabel") %>' height=200, width=400, status=yes, toolbar=no,
menubar=no, location=no'); void('');"> click here</asp:HyperLink>


Any ideas as to what I can do here???
THANK YOU SO MUCH IN ADVANCE!!!


*** Sent via Developersdex http://www.developersdex.com ***

My System SpecsSystem Spec
Old 06-02-2009   #2 (permalink)
Andrew Morton


 
 

Re: Newbie - Help with a string

Joey Martin wrote:
Quote:

> I am just trying to populate a HYPERLINK section and instead and it
> linking to another window, I want to use javascript to open a window
> and set a window size.
Quote:

> THIS DOES NOT WORK. I want to write more variables that are passed
> into the popup window.<%# Eval("KeywordLabel") %>
>
> NavigateUrl="javascript:window.open('popsearch.asp?catKeywords=<%#
> Eval("KeywordLabel") %>' height=200, width=400, status=yes,
> toolbar=no, menubar=no, location=no'); void('');"> click
> here</asp:HyperLink>
You can set the url in the code-behind:

Hyperlink1.NavigateUrl=StringFormat("javascript:window.open('popsearch.asp?catKeywords={0}',height=200,width=400,status=yes,toolbar=no,menubar=no,
location=no);", Server.UrlEncode(KeywordLabel))

(Not tested: parentheses and quotes may not be balanced.)

Andrew


My System SpecsSystem Spec
Old 06-02-2009   #3 (permalink)
Andrew Morton


 
 

Re: Newbie - Help with a string

Andrew Morton wrote:
Quote:

> Hyperlink1.NavigateUrl=StringFormat("javascript:window.open('popsearch.asp?catKeywords={0}',height=200,width=400,status=yes,toolbar=no,menubar=no,
> location=no);", Server.UrlEncode(KeywordLabel))
>
> (Not tested: parentheses and quotes may not be balanced.)
And there's a dot missing from String.Format

Andrew


My System SpecsSystem Spec
Old 06-02-2009   #4 (permalink)
Joey Martin


 
 

Re: Newbie - Help with a string

Ok, so what I am doing wrong here:
<asp:HyperLink ID="LnkPopSearch" runat="server"
NavigateUrl='<%#
string.Format("javascript:window.open('popsearch.asp?catKeywords={0}',nu
ll, 'height=200, width=400, status=yes, toolbar=no, menubar=no,
location=no');", Eval("KeywordsList")%>'><%# Eval("KeywordLabel")
%></asp:HyperLink>




*** Sent via Developersdex http://www.developersdex.com ***
My System SpecsSystem Spec
Old 06-02-2009   #5 (permalink)
Andrew Morton


 
 

Re: Newbie - Help with a string

Joey Martin wrote:
Quote:

> Ok, so what I am doing wrong here:
> <asp:HyperLink ID="LnkPopSearch" runat="server"
> NavigateUrl='<%#
> string.Format("javascript:window.open('popsearch.asp?catKeywords={0}',nu
> ll, 'height=200, width=400, status=yes, toolbar=no, menubar=no,
> location=no');", Eval("KeywordsList")%>'><%# Eval("KeywordLabel")
> %></asp:HyperLink>
You're using <% %> inside an <asp> tag, which may or may not work depending
on which SP of which version of the framework you're using, i.e. it is
unreliable at best. Also, that isn't the code-behind.

http://en.wikipedia.org/wiki/Code-be...e-behind_model

It may at first appear to be simpler to put all the logic on the aspx page
along with the markup, but you will very quickly find it easier to use the
code-behind model.

HTH

Andrew


My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Find a string within a variable string PowerShell
problems with $var | select-string -pattern $string -q PowerShell
How export-csv deals with string versus string[] PowerShell
String PRODUCT_NAME was not found in string table Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46