Hi,
I'm creating my columns dynamically from code bhing. Now I want to add a column as Hyperlink for example I have columns named Name, Age, Country and I want Name column to be a hyperlink column. can some let me know how I can achieve this? I tried creating a template field and then adding the hyperlink to the template field in Initialiserow command, but I'm unable to get the item value for Name column i.e. row.items[0].Text is returning me a null value when as when I delcare the same field as Bound field I'm getting the value.
Thanks in advance.
Regards
Surya
Hello Surya,
Thank you for posting in our forums!
You can access the data for the row during the InitializeRow event through the e.Row.DataItem property. This property stores the data values used for each column in the current row. See below for an example of how you can use this:
DataRowView data = e.Row.DataItem as DataRowView; link.Text = data["Name"].ToString();
link.Text = data["Name"].ToString();
I have also attached a sample that demonstrates creating a link through this method.
If you have any further questions or concerns with this, please let me know and I will be glad to help.
Please let me know if you need further assistance with this issue.
When stepping through my OnInitializeRow handler, I see that e.Row.DataItem is a System.Data.DataRowView when arriving on the page but it's a Infragistics.Web.UI.Framework.Data.DataRecord when leaving the page. Why is that? The call stack looks exactly that same in both cases.