I have a whdg with one child column defined as an itemtemplate to contain hyperlinks.
If there are 4 hyperlinks in one row . How can I get each of them to appear on different lines like:
www.google.com
www.gmail.com
www.sd.com
www.sdf.com
instead of all of them on the same line(which is how its currently being rendered )
Hello,
Thank you for your feedback and for sharing this with us. We believe that the other community members could benefit from such threads.
Thanks for looking at this.
Since its been a year that I asked this question. Here is what I did at the time to get it working:
<iggrid:TemplateDataField Key="ReferenceColumn" Hidden="True">
<ItemTemplate>
<asp:Panel ID="explink" runat="server" >
</asp:Panel>
</ItemTemplate>
<Header Text="Reference" />
</iggrid:TemplateDataField>
Code behind in InitializeRowEvent:
string[] link;
string itemId;
string linkURL;
string refText = e.Row.Items.FindItemByKey("ReferenceColumn").Value.ToString();
if (refText.IndexOf(Environment.NewLine) > 0)
{
foreach (string refLink in refText.Split(new string[] { System.Environment.NewLine }, StringSplitOptions.None))
if (refLink.Trim().Length > 0 && refLink.IndexOf("|") > 0)
link = refLink.Split("|".ToCharArray());
itemId = link[0].Replace("XX-ING-ADV:", "");
linkURL = CriticalWatch.HttpUrlBuilder.BuildUrl("~/ListView.aspx", "OU=" + ou + "&ItemId=" + itemId);
var panellink = ((Panel)e.Row.Items.FindItemByKey("ReferenceColumn").FindControl("explink"));
HyperLink h =new HyperLink();
h.NavigateUrl ="BLOCKED SCRIPTopenPopupWindow('" + linkURL + "','newwin',500,500,'yes');";
h.Text = linkURL +"</br>";
panellink.Controls.Add(h);
}
else
if (refText.Trim().Length > 0)
if (refText.IndexOf("|") > 0)
link = refText.Split("|".ToCharArray());
refText.Replace(Environment.NewLine,"<br/>");
In order to achieve this functionality, you could modify the aspx file in the markup and add <br> tags like this:
Currently the data for that column comes back as:
www.google.com\r\nwww.gmail.com\r\nwww.sd.com\r\nwww.sdf.com