
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..
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="Ed.WebForm1" %>
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<telerik:RadScriptManager ID="m" runat="server">
</telerik:RadScriptManager>
<style type="text/css">
/* The following CSS needs to be copied to the page to produce textbox-like RadEditor */
.reLeftVerticalSide,
.reRightVerticalSide,
.reToolZone,
.reToolCell
{
background: white !important;
}
.reContentCell
{
border-width: 0 !important;
}
.RadEditor
{
filter: chroma(color=c2dcf0);
}
</style>
<br />
<br/>
<br />
<br/>
<br />
<telerik:RadEditor ID="Q" Runat="server" Height="150px" Width="660px" ToolsWidth="660px" ToolbarMode="ShowOnFocus" EditModes="Design" AutoResizeHeight="true" Skin="Vista">
</telerik:RadEditor>
</form>
</body>
</html>
