Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Hyperlink Columns


Message #1 by "Hugh McLaughlin" <hugh@k...> on Sat, 1 Dec 2001 12:52:52
Hello Everyone and thanks for your help in advance.  I am using a datagrid 

to display a list of books with the database fields ISBN, Title, and 

PublicationDate.  I am trying to format the Title with a hyperlink to 

another page "AddToCart.aspx" that attaches the ISBN as a querystring for 

further processing.  I am using the following code for the hyperlink 

column:



      <ASP:HyperlinkColumn HeaderText="<b>Book Title</b>" 

DataNavigateURLField="Title" DataNavigateURLFormatString="AddToCart.aspx?

productID=<%# Container.DataItem('ISBN') %>" DataTextField="Title"/>



Instead of binding the ISNB, the link is coming out:



AddToCart.aspx?productID=<%# Container.DataItem('ISBN') %>



I have used the Page.Databind() and all of the other fields have bound 

properly, so i am not sure why I am having this problem.  Any help would 

be greatly appreciated.  Thanks.
Message #2 by "Dan Green" <dan@d...> on Sun, 2 Dec 2001 07:53:31 +1100
Try...

<ASP:HyperlinkColumn

  HeaderText="<b>Book Title</b>"

  DataNavigateURLField="ISBN"

  DataNavigateURLFormatString="AddToCart.aspx?productID={0}"

  DataTextField="Title" />



The difference is the use of the placeholder "{0}" tag within the

DataNavigateURLFormatString.  The placeholder will be filled with the

value specified in DataNavigateURLField during databinding.





Dan Green

[ http://dotnetdan.com -- putting the dan in .net ]



> -----Original Message-----

> From: Hugh McLaughlin [mailto:hugh@k...]

> Sent: Saturday, 1 December 2001 12:53 PM

> To: ASP+

> Subject: [aspx] Hyperlink Columns

> 

> Hello Everyone and thanks for your help in advance.  I am using a

datagrid

> to display a list of books with the database fields ISBN, Title, and

> PublicationDate.  I am trying to format the Title with a hyperlink to

> another page "AddToCart.aspx" that attaches the ISBN as a querystring

for

> further processing.  I am using the following code for the hyperlink

> column:

> 

>       <ASP:HyperlinkColumn HeaderText="<b>Book Title</b>"

> DataNavigateURLField="Title"

DataNavigateURLFormatString="AddToCart.aspx?

> productID=<%# Container.DataItem('ISBN') %>" DataTextField="Title"/>

> 

> Instead of binding the ISNB, the link is coming out:

> 

> AddToCart.aspx?productID=<%# Container.DataItem('ISBN') %>

> 

> I have used the Page.Databind() and all of the other fields have bound

> properly, so i am not sure why I am having this problem.  Any help

would

> be greatly appreciated.  Thanks.

> ---

> VBug Winter Conference 2001

> 

> Open Forum:  Dan Appleman will be hosting an open

> forum at The .NET Developer's Conference on

> 29th November 2001.  The session will give

> developers the chance to discuss and question

> Dan on his experience with the .NET environment.

> Dan has been programming Visual Basic since the

> alpha version 1.0.  And with over 10 years

> Visual Basic experience is well qualified to

> help you on your road to being a .NET Guru.

> 

> http://www.vbug.co.uk/redirect.asp?url=39&id=17

> 

> ---

> You are currently subscribed to

> aspx as: dangreen@b...


> $subst('Email.Unsub')

> Read the future with ebooks at B&N

>

http://service.bfast.com/bfast/click?bfmid=2181&sourceid=38934667&catego

ry

> id=rn_ebooks



Message #3 by "Sam R. Akhtar" <sam@d...> on Sat, 1 Dec 2001 16:36:59 -0500
Hugh,



Try:



<ASP:HYPERLINKCOLUMN datatextfield="Facility"

	DataTextField="Title"

	DataNavigateURLField="ISBN"

	DataNavigateURLFormatString="AddToCart.aspx?productID={0}" />





Now, assuming the DataTable in the DataSet you are binding to the DataGrid

has an ISBN, the URL should come out:



AddToCart.aspx?productID=524724627647432



or whatever the ISBN # is ...



Hope that helped ...





SRA



>       <ASP:HyperlinkColumn HeaderText="<b>Book Title</b>"

> DataNavigateURLField="Title" DataNavigateURLFormatString="AddToCart.aspx?

> productID=<%# Container.DataItem('ISBN') %>" DataTextField="Title"/>

>

> Instead of binding the ISNB, the link is coming out:

>

> AddToCart.aspx?productID=<%# Container.DataItem('ISBN') %>







Message #4 by "Hugh McLaughlin" <hugh@k...> on Sun, 2 Dec 2001 22:37:04
> Try...

> <ASP:HyperlinkColumn

>   HeaderText="<b>Book Title</b>"

>   DataNavigateURLField="ISBN"

>   DataNavigateURLFormatString="AddToCart.aspx?productID={0}"

>   DataTextField="Title" />

> 

> The difference is the use of the placeholder "{0}" tag within the

> DataNavigateURLFormatString.  The placeholder will be filled with the

> value specified in DataNavigateURLField during databinding.

> 

> 

> Dan Green

> [ http://dotnetdan.com -- putting the dan in .net ]

> 

> > -----Original Message-----

> > From: Hugh McLaughlin [mailto:hugh@k...]

> > Sent: Saturday, 1 December 2001 12:53 PM

> > To: ASP+

> > Subject: [aspx] Hyperlink Columns

> > 

> > Hello Everyone and thanks for your help in advance.  I am using a

> datagrid

> > to display a list of books with the database fields ISBN, Title, and

> > PublicationDate.  I am trying to format the Title with a hyperlink to

> > another page "AddToCart.aspx" that attaches the ISBN as a querystring

> for

> > further processing.  I am using the following code for the hyperlink

> > column:

> > 

> >       <ASP:HyperlinkColumn HeaderText="<b>Book Title</b>"

> > DataNavigateURLField="Title"

> DataNavigateURLFormatString="AddToCart.aspx?

> > productID=<%# Container.DataItem('ISBN') %>" DataTextField="Title"/>

> > 

> > Instead of binding the ISNB, the link is coming out:

> > 

> > AddToCart.aspx?productID=<%# Container.DataItem('ISBN') %>

> > 

> > I have used the Page.Databind() and all of the other fields have bound

> > properly, so i am not sure why I am having this problem.  Any help

> would

> > be greatly appreciated.  Thanks.

> > ---

> > VBug Winter Conference 2001

> > 

> > Open Forum:  Dan Appleman will be hosting an open

> > forum at The .NET Developer's Conference on

> > 29th November 2001.  The session will give

> > developers the chance to discuss and question

> > Dan on his experience with the .NET environment.

> > Dan has been programming Visual Basic since the

> > alpha version 1.0.  And with over 10 years

> > Visual Basic experience is well qualified to

> > help you on your road to being a .NET Guru.

> > 

> > http://www.vbug.co.uk/redirect.asp?url=39&id=17

> > 

> > ---

> > You are currently subscribed to

> > aspx as: dangreen@b...


> > $subst('Email.Unsub')

> > Read the future with ebooks at B&N

> >

> http://service.bfast.com/bfast/click?bfmid=2181&sourceid=38934667&catego

> ry

> > id=rn_ebooks

> 

Thanks Dan.  This was very helpful.  Should I assume that you can only 

bind one querystring value based on the placeholder?
Message #5 by "Samuel Engelman" <samuel_engelman@p...> on Mon, 3 Dec 2001 12:33:02 -0500
You can bind as many columns as you want using this sytax



DataNavigateURLFormatString="<%# "AddToCart.aspx?productID=" +

Container.DataItem('ISBN') %>"







|--------+--------------------------------->

|        |   "Hugh McLaughlin"             |

|        |   <hugh@k...>         |

|        |                                 |

|        |                                 |

|        |   Sunday December 2, 2001 05:37 |

|        |   PM                            |

|        |   Please respond to "ASP+"      |

|        |                                 |

|--------+--------------------------------->

  >--------------------------------------------------|

  |                                                  |

  |      To:                                  "ASP+" |

  |       <aspx@p...>                        |

  |      cc:                                         |

  |      Subject: [aspx] RE: Hyperlink Columns       |

  >--------------------------------------------------|









> Try...

> <ASP:HyperlinkColumn

>   HeaderText="<b>Book Title</b>"

>   DataNavigateURLField="ISBN"

>   DataNavigateURLFormatString="AddToCart.aspx?productID={0}"

>   DataTextField="Title" />

>

> The difference is the use of the placeholder "{0}" tag within the

> DataNavigateURLFormatString.  The placeholder will be filled with the

> value specified in DataNavigateURLField during databinding.

>

>

> Dan Green

> [ http://dotnetdan.com -- putting the dan in .net ]

>

> > -----Original Message-----

> > From: Hugh McLaughlin [mailto:hugh@k...]

> > Sent: Saturday, 1 December 2001 12:53 PM

> > To: ASP+

> > Subject: [aspx] Hyperlink Columns

> >

> > Hello Everyone and thanks for your help in advance.  I am using a

> datagrid

> > to display a list of books with the database fields ISBN, Title, and

> > PublicationDate.  I am trying to format the Title with a hyperlink to

> > another page "AddToCart.aspx" that attaches the ISBN as a querystring

> for

> > further processing.  I am using the following code for the hyperlink

> > column:

> >

> >       <ASP:HyperlinkColumn HeaderText="<b>Book Title</b>"

> > DataNavigateURLField="Title"

> DataNavigateURLFormatString="AddToCart.aspx?

> > productID=<%# Container.DataItem('ISBN') %>" DataTextField="Title"/>

> >

> > Instead of binding the ISNB, the link is coming out:

> >

> > AddToCart.aspx?productID=<%# Container.DataItem('ISBN') %>

> >

> > I have used the Page.Databind() and all of the other fields have bound

> > properly, so i am not sure why I am having this problem.  Any help

> would

> > be greatly appreciated.  Thanks.

> > ---

> > VBug Winter Conference 2001

> >

> > Open Forum:  Dan Appleman will be hosting an open

> > forum at The .NET Developer's Conference on

> > 29th November 2001.  The session will give

> > developers the chance to discuss and question

> > Dan on his experience with the .NET environment.

> > Dan has been programming Visual Basic since the

> > alpha version 1.0.  And with over 10 years

> > Visual Basic experience is well qualified to

> > help you on your road to being a .NET Guru.

> >

> > http://www.vbug.co.uk/redirect.asp?url=39&id=17

> >

> > ---

> > You are currently subscribed to

> > aspx as: dangreen@b...


> > $subst('Email.Unsub')

> > Read the future with ebooks at B&N

> >

> http://service.bfast.com/bfast/click?bfmid=2181&sourceid=38934667&catego

> ry

> > id=rn_ebooks

>

Thanks Dan.  This was very helpful.  Should I assume that you can only

bind one querystring value based on the placeholder?

---

VBug Winter Conference 2001



Open Forum:  Dan Appleman will be hosting an open

forum at The .NET Developer's Conference on

29th November 2001.  The session will give

developers the chance to discuss and question

Dan on his experience with the .NET environment.

Dan has been programming Visual Basic since the

alpha version 1.0.  And with over 10 years

Visual Basic experience is well qualified to

help you on your road to being a .NET Guru.



http://www.vbug.co.uk/redirect.asp?url=39&id=17



---

You are currently subscribed to

aspx as: Samuel_Engelman@p...


$subst('Email.Unsub')

Read the future with ebooks at B&N

http://service.bfast.com/bfast/click?bfmid=2181&sourceid=38934667&categoryid=rn_ebooks








  Return to Index