Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11571

Item link in Hyperlink in custom webpart...

$
0
0

Hi All

I want to display list item in Visual webpart. So i have created a Repeator control, In ItemTemplate I have created a table, In td i have added a hyperlink. I am able to feach the items and added the items to a lable but when i click that link i am unable to view that item. I am unable to bind the AbsolutePath URl to hyperlink. Can someone please help me on this, Below is the code which i have written.

<td class="ms-vb2" align="left" >

<asp:HyperLink ID="lnkFileName" runat="server" NavigateUrl='<%# Eval("AbsolutePath") %>'

Target="_blank" ToolTip='<%# Eval("AbsolutePath") %> '>

<asp:Literal ID="litFileNameText" runat="server" Text='<%# Eval("Title") %>' />

</asp:HyperLink></td>

cs file..

DataTable dt = new DataTable();

if (oListCollection.Count > 0)

{

dt.Columns.Add("Title");

// bindToDataTable(oListCollection , dt);

foreach (SPListItem item in oListCollection)

{


string AbsolutePath = String.Format("{0}", item["EncodedAbsUrl"]);

string Title = string.Empty;

Title = string.Format("{0}", item["Title"].ToString());

DataRow dr = dt.NewRow();

dr["Title"] = string.Format("{0}", Title);

dt.Rows.Add(dr);

}


rptrRecentlyAdded.DataSource = dt;

rptrRecentlyAdded.DataBind();

 Thanks & Regards

Rakesh


Viewing all articles
Browse latest Browse all 11571

Trending Articles