I have a RadGrid and it get popultated from a view, but I want to stop it as it inserts into one of the colums and I want todo some things here, and I can get the event and I can find everything I find my value that I want to change, but after chaneing it nothing happends.
My guess is that it has either already been bound, or that I have to rebind the grid or something similar so I hope I could get an answer here. Some of my sample code and what I want todo, maybe someone has a better ide on how to handle the problem.
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridDataItem)
{
GridDataItem dataItem = (GridDataItem)e.Item;
DataRowView groupDataRow = (DataRowView)e.Item.DataItem;
string test = groupDataRow.Row.ItemArray[1].ToString();
groupDataRow.Row.ItemArray[1] = "testing";
}
}
Now this simple code is just used for testing as you can guess, if I put a break there I can see all the values fine, the string called test gets the right value and everything, but I then try to change the groupDataRow.Row.ItemArray[1] = "testing"; nothing happens, it doesn't crash but the grid still has the old value that I can see in my test string.
What I want todo here is to simply replace the string with a link, I have a method that will get my link and it should only do that so a psedocode would look something like:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
if (e.Item is GridDataItem)
{
GridDataItem dataItem = (GridDataItem)e.Item;
DataRowView groupDataRow = (DataRowView)e.Item.DataItem;
Hyperlink link = CreateLink(groupDataRow.Row.ItemArray[3]);
groupDataRow.Row.ItemArray[1] = link;
}
}
This would then use one of the values to create the link and then I would simply replace the text with that link, where the CreateLink function would set the correct link and text for it. Maybe there is another way todo this, but as I said this grid is bound to a sqlview, maybe you can do links or hrefs there, I don't know tbh.
Thanks for any help!
Edit: The formating on the code looks strange, but I hope you can live with that since I can't change it..