Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > DataSet bound DataGrid with hyperlinks question

Reply
Thread Tools

DataSet bound DataGrid with hyperlinks question

 
 
Alex
Guest
Posts: n/a
 
      04-15-2004
I'm reposting my issue with some more info.

I would like to use a DataGrid to display my DataSet.
My DataSet is from a table in a SQL DB.
Both columns in the table are strings.

I would like it to look like the following where the URL column is
clickable.

---------------------------------------------
name | URL
---------------------------------------------
Microsoft | http:\\www.microsoft.com
---------------------------------------------
CNN | http:\\www.cnn.com
---------------------------------------------

I would like to use data binding.

However if I'm using a data bound columns I can't get the hyperlink
functionality. Or I don't know how do this. Is there a simple formatting
trick?

If I use a hyperlink column I can't use data binding.


 
Reply With Quote
 
 
 
 
ashish
Guest
Posts: n/a
 
      04-15-2004
Look into how to to create template columns in the DataGrid to customize
appearance

for example

<aspataGrid id="DataGrid1" runat="server">
<columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:label name="lblname" runat="server"
text='<%# DataBinder.Eval(Container.DataItem,"ColumnName") %>' >
</asp:label>
<asp:HyperLink id=lnkImage Runat="server" NavigateUrl='<%#
DataBinder.Eval(Container.DataItem,"Columnlink") %>'></asp:HyperLink>
</ItemTemplate>
</asp:TemplateColumn>
</columns>
</asp:datagrid>


hth
-ashish

Alex wrote:

> I'm reposting my issue with some more info.
>
> I would like to use a DataGrid to display my DataSet.
> My DataSet is from a table in a SQL DB.
> Both columns in the table are strings.
>
> I would like it to look like the following where the URL column is
> clickable.
>
> ---------------------------------------------
> name | URL
> ---------------------------------------------
> Microsoft | http:\\www.microsoft.com
> ---------------------------------------------
> CNN | http:\\www.cnn.com
> ---------------------------------------------
>
> I would like to use data binding.
>
> However if I'm using a data bound columns I can't get the hyperlink
> functionality. Or I don't know how do this. Is there a simple formatting
> trick?
>
> If I use a hyperlink column I can't use data binding.
>
>

 
Reply With Quote
 
 
 
 
Alex
Guest
Posts: n/a
 
      04-15-2004
Thanks!

I didn't realize that I can mix and match.
<Columns>
<asp:BoundColumn DataField="Name" HeaderText="col
Name"></asp:BoundColumn>
<asp:TemplateColumn HeaderText="Link">
<ItemTemplate>
<asp:HyperLink id=lnk Runat="server"
NavigateUrl='<%#DataBinder.Eval(Container.DataItem ,"mylink")%>'><%#DataBinde
r.Eval(Container.DataItem,"mylink")%></asp:HyperLink>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>

"ashish" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Look into how to to create template columns in the DataGrid to customize
> appearance
>
> for example
>
> <aspataGrid id="DataGrid1" runat="server">
> <columns>
> <asp:TemplateColumn>
> <ItemTemplate>
> <asp:label name="lblname" runat="server"
> text='<%# DataBinder.Eval(Container.DataItem,"ColumnName") %>' >
> </asp:label>
> <asp:HyperLink id=lnkImage Runat="server" NavigateUrl='<%#
> DataBinder.Eval(Container.DataItem,"Columnlink") %>'></asp:HyperLink>
> </ItemTemplate>
> </asp:TemplateColumn>
> </columns>
> </asp:datagrid>
>
>
> hth
> -ashish
>
> Alex wrote:
>
> > I'm reposting my issue with some more info.
> >
> > I would like to use a DataGrid to display my DataSet.
> > My DataSet is from a table in a SQL DB.
> > Both columns in the table are strings.
> >
> > I would like it to look like the following where the URL column is
> > clickable.
> >
> > ---------------------------------------------
> > name | URL
> > ---------------------------------------------
> > Microsoft | http:\\www.microsoft.com
> > ---------------------------------------------
> > CNN | http:\\www.cnn.com
> > ---------------------------------------------
> >
> > I would like to use data binding.
> >
> > However if I'm using a data bound columns I can't get the hyperlink
> > functionality. Or I don't know how do this. Is there a simple formatting
> > trick?
> >
> > If I use a hyperlink column I can't use data binding.
> >
> >



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Lower bound & Upper bound sunil panda Java 9 10-07-2008 08:32 PM
How to represent the data in a not bound control via bound control Mario Krsnic ASP .Net 0 06-23-2006 07:38 AM
Getting lower-bound and upper-bound of strings input Rhiner Dan C++ 1 03-27-2005 02:03 AM
typed DataSet-bound DataGrid sorting Whugster ASP .Net Web Controls 2 06-29-2004 02:00 PM
Data formatting expression wanted for dataset bound datagrid column for href Alex ASP .Net 0 04-14-2004 04:03 PM



Advertisments