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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ashish PatelCommented:
simple use this type of hyperlink

<a href="http://www.xyz.com/label.aspx?bc={0}" target="winvar">something</a>
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?

Ashish PatelCommented:
the final result should look like below.

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

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

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.
pamsautoAuthor Commented:
There is no code, it is a formatting string in the datagrid control.
Ashish PatelCommented:
Can you make it look like below?

<a href="http://www.qrppep.com/label.aspx?bc=90234" target="winvar">90234</a>
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.
Ashish PatelCommented:
can you paste your code where you are creating this datagrid hyperlink cells
pamsautoAuthor Commented:
<asp:HyperLinkColumn DataNavigateUrlField="BarCode" DataNavigateUrlFormatString="http://www.qrppep.com/label.aspx?bc={0} target=winvar"
                                                      DataTextField="Barcode" HeaderText="BarCode"></asp:HyperLinkColumn>
                                                
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>
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.
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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
pamsautoAuthor Commented:
That worked perfect!   Thanks for the help.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.