Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Building Controls (http://www.velocityreviews.com/forums/f59-asp-net-building-controls.html)
-   -   Multiple Parameters With Hyperlink in DataGrid (http://www.velocityreviews.com/forums/t755515-multiple-parameters-with-hyperlink-in-datagrid.html)

eRic 07-10-2003 12:39 AM

Multiple Parameters With Hyperlink in DataGrid
 
I have a datagrid with a hyperlinkcontrol column. And it will only take one
parameter. So I created a template column, with a hyperlink based on an
example I saw. (now working directly in the aspx page as opposed to the code
behind) It uses the NavigateURL and then useses
Container.DataItem("itemName") to set the item values inline (so
'someUrl.com?item=.' + Container.DataItem("itemName") ) First off I'm doing
this in C# so I changed the call to Container.DataItem["itemName"]. Now it
throwsa HTML excepetion because the "object" cannot be index. any
suggestions on how to do this. I have tried casting the container but to no
avail.

My overall goal is to pass 2 parameters in a query string of a hyperlink
that is embeded in a datagrid. :)

THANKS!!
eRic



Victor Garcia Aprea [MVP] 07-11-2003 11:41 PM

Re: Multiple Parameters With Hyperlink in DataGrid
 
Hi Eric,

Could you post a code snippet along with the exact text for the error?

--
Victor Garcia Aprea
Microsoft MVP | ASP.NET
Looking for insights on ASP.NET? Read my blog:
http://obies.com/vga/blog.aspx

To contact me remove 'NOSPAM'. Please post all questions to the newsgroup

and not by private mail.
"eRic" <ezadler@hotmail.com> wrote in message
news:eZqQzunRDHA.2008@TK2MSFTNGP11.phx.gbl...
> I have a datagrid with a hyperlinkcontrol column. And it will only take

one
> parameter. So I created a template column, with a hyperlink based on an
> example I saw. (now working directly in the aspx page as opposed to the

code
> behind) It uses the NavigateURL and then useses
> Container.DataItem("itemName") to set the item values inline (so
> 'someUrl.com?item=.' + Container.DataItem("itemName") ) First off I'm

doing
> this in C# so I changed the call to Container.DataItem["itemName"]. Now

it
> throwsa HTML excepetion because the "object" cannot be index. any
> suggestions on how to do this. I have tried casting the container but to

no
> avail.
>
> My overall goal is to pass 2 parameters in a query string of a hyperlink
> that is embeded in a datagrid. :)
>
> THANKS!!
> eRic
>
>




David Rothgery 07-12-2003 12:20 AM

Re: Multiple Parameters With Hyperlink in DataGrid
 

"Victor Garcia Aprea [MVP]" <vga@NOobiesSPAM.com> wrote in message
news:OYBZrXASDHA.2460@TK2MSFTNGP10.phx.gbl...
[borrowing Victor's post because I lost the original on my newsspool]

> "eRic" <ezadler@hotmail.com> wrote in message
> news:eZqQzunRDHA.2008@TK2MSFTNGP11.phx.gbl...
> > I have a datagrid with a hyperlinkcontrol column. And it will only take

> one
> > parameter. So I created a template column, with a hyperlink based on an
> > example I saw. (now working directly in the aspx page as opposed to the

> code
> > behind) It uses the NavigateURL and then useses
> > Container.DataItem("itemName") to set the item values inline (so
> > 'someUrl.com?item=.' + Container.DataItem("itemName") ) First off I'm

> doing
> > this in C# so I changed the call to Container.DataItem["itemName"]. Now

> it
> > throwsa HTML excepetion because the "object" cannot be index. any
> > suggestions on how to do this. I have tried casting the container but

to
> no
> > avail.
> >
> > My overall goal is to pass 2 parameters in a query string of a hyperlink
> > that is embeded in a datagrid. :)


Just as a note...

It might be a little bit cheesy, but why not build the query string for each
row in SQL (something like like SELECT 'item1=' + item1 + '&item2=' + item2
AS QueryString) and then use that in your datagrid?



--
Dave Rothgery
drothgery@alum.wpi.edu



Joe Glover 07-13-2003 11:25 AM

Re: Multiple Parameters With Hyperlink in DataGrid
 
Hi eRic

Forgetting about template columns for the time being, I think the following
should work for you:

<asp:HyperLinkColumn DataNavigateUrlField="itemName"
DataNavigateUrlFormatString="someUrl.com?item={0}"
DataTextField="itemName"></asp:HyperLinkColumn>

HTH
Joe

"eRic" <ezadler@hotmail.com> wrote in message
news:eZqQzunRDHA.2008@TK2MSFTNGP11.phx.gbl...
> I have a datagrid with a hyperlinkcontrol column. And it will only take

one
> parameter. So I created a template column, with a hyperlink based on an
> example I saw. (now working directly in the aspx page as opposed to the

code
> behind) It uses the NavigateURL and then useses
> Container.DataItem("itemName") to set the item values inline (so
> 'someUrl.com?item=.' + Container.DataItem("itemName") ) First off I'm

doing
> this in C# so I changed the call to Container.DataItem["itemName"]. Now

it
> throwsa HTML excepetion because the "object" cannot be index. any
> suggestions on how to do this. I have tried casting the container but to

no
> avail.
>
> My overall goal is to pass 2 parameters in a query string of a hyperlink
> that is embeded in a datagrid. :)
>
> THANKS!!
> eRic
>
>




Eric Adler 07-19-2003 09:19 PM

Re: Multiple Parameters With Hyperlink in DataGrid
 
Yeah, adding 1 parameter to the query string is straight forward,
unfortuately I was trying to add at least 2 parameters. That's why I
needed the template column and the hyperlink control

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Eric Adler 07-19-2003 09:19 PM

Re: Multiple Parameters With Hyperlink in DataGrid
 

Shoot I wish I had captured the error better. I had a tight deadline so
I need came up with a different solution. One where I only needed the
one, easy, query string value. So, in your opinion, was I on the right
track?


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


All times are GMT. The time now is 09:54 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.