I have an xml document formated like this that I am populating a grid with using Autogenerated columns. the Google column does not show as a hyperlink. is there a way to make the autogenerated hyperlink column?
<?xml version="1.0" encoding="utf-16" ?>
<?xml version="1.0" encoding="utf-16" ?>
- <Users>
<USER FirstName="Keith" MiddleName="A" LastName="Delman" Address1="" Address2="" City="Atlanta" State="Georgia" Zip="30301" Google=http://www.google.com/search?hl=en&rls=GGLD,GGLD:2004-50,GGLD:en&q=%22Ted%20Slinkard%22+%22Oncology%22&spell=1 />
</Users>
<USER FirstName="Keith" MiddleName="A" LastName="Delman" Address1="" Address2="" City="Atlanta" State="Georgia" Zip="30301" Google=http://www.google.com/search?hl=en&rls=GGLD,GGLD:2004-50,GGLD:en&q=%22Ted%20Slinkard%22+%22Oncology%22&spell=1 />
</Users>
8 Answers, 1 is accepted
0
Hello Ted,
I followed your scenario in order to replicate the issue but to no avail. Please find attached a small runnable application, which handles the desired functionality. Give it a try and let me know how it goes or if I am leaving something out.
I hope this helps.
Greetings,
Pavlina
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
I followed your scenario in order to replicate the issue but to no avail. Please find attached a small runnable application, which handles the desired functionality. Give it a try and let me know how it goes or if I am leaving something out.
I hope this helps.
Greetings,
Pavlina
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Ted
Top achievements
Rank 1
answered on 03 Apr 2009, 02:27 PM
I see what you are doing but I was hoping to get around modifying each row on Itemdatabound (just for performance as this will be a huge amount of data) but Thanks for the example. I was wondering if with and XML document (not a database) if there was a way to formate the xml to tell the AutoGeneration to make it a hyperlink?
0
Hello Ted,
Note that runtime auto-generated columns will always appear after the user-specified columns, unless the columns are ordered programmatically.
Pavlina
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
Note that runtime auto-generated columns will always appear after the user-specified columns, unless the columns are ordered programmatically.
When the AutoGenerateColumns property is set to true, a GridBoundColumn object is automatically created for each field in the data source. Each field is then displayed as a column in the Telerik RadGrid control in the order that the fields appear in the data source. This option provides a convenient way to display every field in the data source; however, you have limited control of how an automatically generated column field is displayed or behaves.
I hope this information helps.
Pavlina
the Telerik team
Check out Telerik Trainer , the state of the art learning tool for Telerik products.
0
Ted
Top achievements
Rank 1
answered on 17 Apr 2009, 01:54 PM
OK. this worked fine until I added a detail table to my grid. now when I first load the grid it shows the linkbutton but when you click and expand to the detailtable, the mastertableview looses the link button formatting. is there a way to keep this formatting in a hierachical grid?
0
Hi Ted,
Unfortunately I could not reproduce the issue you are facing. At this point in order to progress in the resolution of this matter, I will ask you to open a formal support ticket and send me a small project. It would allow me to track the issue locally.
As soon as I do I will get back to you with additional information/suggestions.
Best wishes,
Pavlina
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Unfortunately I could not reproduce the issue you are facing. At this point in order to progress in the resolution of this matter, I will ask you to open a formal support ticket and send me a small project. It would allow me to track the issue locally.
As soon as I do I will get back to you with additional information/suggestions.
Best wishes,
Pavlina
the Telerik team
Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
0
Stuart Hemming
Top achievements
Rank 2
answered on 22 Jul 2009, 03:08 PM
Ted, Pravlina,
Did a support ticket get raised for this? If so, what was the outcome?
I ask 'cos this is exactly what I'm seeing.
--
Stuart
Did a support ticket get raised for this? If so, what was the outcome?
I ask 'cos this is exactly what I'm seeing.
--
Stuart
0
Ted
Top achievements
Rank 1
answered on 22 Jul 2009, 03:26 PM
Yes, I did get it working. if you are using XML you will want a function similar to this. hopefully that will help you also.
protected
void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridDataItem)
{
BuildLinks(e);
}
}
private static void BuildLinks(GridItemEventArgs e) |
{ |
GridDataItem item = e.Item as GridDataItem; |
TableCell tb = item["Google"]; |
LinkButton lnk = new LinkButton(); |
lnk.ID = "lnk"; |
tb.Controls.Add(lnk); |
if (item.DataItem != null) |
{ |
XPathNavigator nav = ((IXPathNavigable)item.DataItem).CreateNavigator(); |
lnk.Attributes.Add("onClick", "javascript:window.open('" + nav.GetAttribute("Google", nav.NamespaceURI) + "');return false;"); |
} |
lnk.Text = "Google"; |
lnk.Attributes["href"] = "#"; |
} |
0
Stuart Hemming
Top achievements
Rank 2
answered on 22 Jul 2009, 03:47 PM
Thanks Ted.
Sadly, this doesn't solve my problem in that the links disappear if you interact with the grid.
Back to the drawing board! :-)
--
Stuart
Sadly, this doesn't solve my problem in that the links disappear if you interact with the grid.
Back to the drawing board! :-)
--
Stuart