How can i reach my content of href tag from c# to insert a link?

时间:2022-01-25 09:54:35

I'm trying to develop a RSS Management system and I want to put a link the href of baslik1(title1). How can I do this?

我正在尝试开发一个RSS管理系统,我想把一个链接为baslik1(title1)的href。我怎样才能做到这一点?

HTML:

 <div class="sag-re-baslik" id= "baslik1" runat="server">
    <a href="#">A link that reader follows</a>
 </div>

C# (in there list array keeps all links of RSS feeds.)

C#(在列表数组中保留RSS提要的所有链接。)

 this.baslik1.InnerHtml = list[i].Title;
 this.icerik1.InnerHtml = list[i].Description;

1 个解决方案

#1


1  

If you could alter your html a bit we can easily do this

如果你可以改变你的html,我们可以很容易地做到这一点

HTML

<asp:Panel ID="baslik1" runat="server"></asp:Panel>

Code behind

for(int i=0; i<list.Count; i++)
{
    HyperLink link = new HyperLink();
    link.ID = "Feed" + i;
    link.NavigateUrl = "";
    link.Text = list[i].Title;;
    link.Tooltip = list[i].Description;
    baslik1.Controls.Add(link);
}

#1


1  

If you could alter your html a bit we can easily do this

如果你可以改变你的html,我们可以很容易地做到这一点

HTML

<asp:Panel ID="baslik1" runat="server"></asp:Panel>

Code behind

for(int i=0; i<list.Count; i++)
{
    HyperLink link = new HyperLink();
    link.ID = "Feed" + i;
    link.NavigateUrl = "";
    link.Text = list[i].Title;;
    link.Tooltip = list[i].Description;
    baslik1.Controls.Add(link);
}