Datagrid with inline Javascript calling a popup window is giving me an issue

I have a datagrid that has a hyperlink column with the following formating string.

javascript:winvar=window.open('http://www.xyz.com/label.aspx?bc={0}');

The intent is to open a new window with this page in it and that does work,  The issue I have is the page that the datagrid is on clears and displays the word "[object]"

How do I correct the Javascript syntax to not do this?
pamsautoAsked:
Who is Participating?
 
Ashish PatelCommented:
nwo try, this should work, i dont know why you are having issues, but lets try this.

<asp:HyperLinkColumn
HeaderText="BarCode"
DataNavigateUrlField="BarCode"
DataNavigateUrlFormatString="label.aspx?bc={0}"
DataTextField="Barcode"
DataTextFormatString="{0:c}"
Target="_blank" />

for more info view the link below.

http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.hyperlinkcolumn.aspx
0
 
Ashish PatelCommented:
simple use this type of hyperlink

<a href="http://www.xyz.com/label.aspx?bc={0}" target="winvar">something</a>
0
 
pamsautoAuthor Commented:
So the link works on a test page in just HTML, but if I use that as a Formating string, it does not work.   Here is how I used it as a formating string

"http://www.qrppep.com/label.aspx?bc={0}" target="winvar"

Here is what the page html source shows after the page is assembled.

<a href="&quot;http://www.qrppep.com/label.aspx?bc=90234"; target=&quot;winvar&quot;">90234</a>

I also tried this formating string.

http://www.qrppep.com/label.aspx?bc={0} target=winvar

And here is the html source at runtime.

<a href="http://www.qrppep.com/label.aspx?bc=90234 target=winvar">90234</a>

What am I doing wrong?

0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
Ashish PatelCommented:
the final result should look like below.

<a href="http://www.qrppep.com/label.aspx?bc=90234" target="winvar">90234</a>
0
 
Ashish PatelCommented:
so to achieve the final result like below

<a href="http://www.qrppep.com/label.aspx?bc=90234" target="winvar">90234</a>

i guess i will have to look at your code where you are formatting your string. Can you please paste that part of the code so that we can fix it for you.
0
 
pamsautoAuthor Commented:
There is no code, it is a formatting string in the datagrid control.
0
 
Ashish PatelCommented:
Can you make it look like below?

<a href="http://www.qrppep.com/label.aspx?bc=90234" target="winvar">90234</a>
0
 
pamsautoAuthor Commented:
That is the issue.   The datagrid html encodes the data the prevent cross site scripting and I don't think there is a way to turn it off like there is in 2.0 and higher.  I really dont want to build a custom databind event for this, it really should just be a simple java scrip syntax issue.   I DO NOT use JS very often, so that is what I really need help with.
0
 
Ashish PatelCommented:
can you paste your code where you are creating this datagrid hyperlink cells
0
 
pamsautoAuthor Commented:
<asp:HyperLinkColumn DataNavigateUrlField="BarCode" DataNavigateUrlFormatString="http://www.qrppep.com/label.aspx?bc={0} target=winvar"
                                                      DataTextField="Barcode" HeaderText="BarCode"></asp:HyperLinkColumn>
                                                
0
 
Ashish PatelCommented:
okay so now use this and try

<asp:HyperLinkColumn DataNavigateUrlField="BarCode" DataNavigateUrlFormatString="http://www.qrppep.com/label.aspx?bc={0}" target="winvar"  DataTextField="Barcode" HeaderText="BarCode"></asp:HyperLinkColumn>
0
 
pamsautoAuthor Commented:
That gives this result.

<a href="=&quot;http://www.qrppep.com/label.aspx?bc=90402"; target=&quot;winvar&quot;">90402</a>

Which does not function.
0
 
pamsautoAuthor Commented:
That worked perfect!   Thanks for the help.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.