How to add hyperlink to an ultragrid column
where the link directs to new page consisting of the data related to tha ID
Here is another KB file that shows the example.
http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.Aspx?ArticleID=1383
hs2
hi guys,
Looking at this thread, and a few others when searching. I have tried the approach listed in this thread, and this KB (http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.Aspx?ArticleID=1383) but it isn't working. When I click my link, I go to the directory. Any help would be much appreciated. I am sure it is something simple I am missing.
my initialize row (i set a break point, and it is being hit) but my link takes me to http://localhost:2917/ (Directory Listing -- /)
protected void uwg_NoFutureApts_InitializeRow(object sender, Infragistics.WebUI.UltraWebGrid.RowEventArgs e) { e.Row.Cells[0].TargetURL = "@[_blank]RescheduleAttempt.aspx?id=" + e.Row.Cells[7].Value.ToString(); }
I am having the same problem where setting the TargetUrl has no effect. All I have done is add an unbound column and set the Key and NullText properties, nothing else. Then in the InitializeRow, I have set the TargetUrl to the appropriate page, but when clicked, it just goes to the "directory listing".
Here is my InitializeRow:
protected void UltraWebGrid1_InitializeRow(object sender, Infragistics.WebUI.UltraWebGrid.RowEventArgs e) { e.Row.Cells.FromKey("UnboundColumn").TargetURL = "Page.aspx"; }
The only way I have got the hyperlink column to work is by setting the text to HTML, but this seems like a hack, and I would sure like to get the TargetURL way working:
protected void UltraWebGrid1_InitializeRow(object sender, Infragistics.WebUI.UltraWebGrid.RowEventArgs e) { e.Row.Cells.FromKey("UnboundColumn").Text = "<a href='Page.aspx'>Show Page</a>"; }
Any ideas on what I am missing? I am using version 2009 volume 1 (9.1.20091.1015).
I found that if I populate the Value in the InitializeRow with anything, then the TargetURL works. I was using NullText property to display the Text for the link to the user, and I would be fine to use DefaultValue instead, but in the designer the DefaultValue property is grayed out, so the Value property has to be populated in the InitializeRow.
protected void UltraWebGrid1_InitializeRow(object sender, Infragistics.WebUI.UltraWebGrid.RowEventArgs e) { e.Row.Cells.FromKey("UnboundColumn").Value= "Click Me!"; e.Row.Cells.FromKey("UnboundColumn").TargetURL = "Page.aspx"; }