Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > How do I add hyperlink to Item template column

Reply
Thread Tools

How do I add hyperlink to Item template column

 
 
Reetu
Guest
Posts: n/a
 
      07-17-2003
Hi,

I have been searching on how I could add hyperlink to
Item template column's data



Code in HTML mode

<ItemTemplate>
<asp:HyperLink NavigateUrl='<%# ShowTaskUrl
(Container.DataItem) %>' Runat=server>
%# GetTaskName(Container.DataItem) %>
</asp:HyperLink>
</ItemTemplate>

At present I have written the following code to retrieve
the value. I am able to get the data but I want it be a
hyperlink. I read few articles mentioning about
HyperlinkColumn. But I am still not clear on how I should
apply it to a template Column

//** TemplateColumn code displaying data without
hyperlink **//

TemplateColumn DynamicTaskItemTemplate = new TemplateColumn
();
DynamicTaskItemTemplate.HeaderText = "Task";
DynamicTaskItemTemplate.ItemTemplate = new
DynamicTaskItemTemplate();

// CODE of DynamictaskItemTemplate

public class DynamicTaskItemTemplate : ITemplate
{
public void InstantiateIn(Control container)
{
Literal lc = new Literal();
lc.DataBinding += new EventHandler
(this.DoDataBinding);
container.Controls.Add(lc);
}

public void DoDataBinding(object sender, EventArgs e)
{
Literal lc = (Literal)sender;
DataGridItem container = (DataGridItem)
lc.NamingContainer;
DataRowView drv = (DataRowView)container.DataItem;
string name = (string)drv["Name"];
lc.Text = name;
}

}

Thanks
-Reetu

 
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
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
How to add a hyperlink column to asp.net datagrid - where only one value is a hyperlink davetichenor ASP .Net 1 10-30-2006 02:57 PM
How to add a hyperlink column to asp.net datagrid - where only one value is a hyperlink Dave ASP .Net Datagrid Control 0 10-21-2006 07:48 PM
How to assign a column of URLs to Hyperlink Column of a DataGrid c =?Utf-8?B?ZGF2aWQ=?= ASP .Net 11 07-17-2006 07:20 PM
HyperLink Column and Button Column in a DataGrid =?Utf-8?B?V2FyYW4=?= ASP .Net 0 08-09-2005 12:00 AM



Advertisments