I'd like to have only a link and the entire text clickable and both dynamically set. I don't know how to replace them. I tried below code and when it gets called more than one time I get null pointer exception
error.
I tried using this:
void setLink(string label, string link)
{
linkLabel1.Text = label;
if (linkLabel1.Links.Count > 0)
{
linkLabel1.Links.RemoveAt(0);
}
linkLabel1.Links.Add(0, label.Length, link);
}
that's called from like this:
foreach(Foo f in fooArr) {
setLink(f.name, f.url);
// ... do something
}
Foo
is:
public class Foo
{
public string name { get; set; }
public string url { get; set; }
}
and fooArr
just List<Foo>