Hi,
I have a radGrid to which I need to give links to few columns and I am doing as given below:
protected void radGrid_PreRender(object sender, EventArgs e)
{
foreach (GridDataItem dataItem in radGrid.Items)
{
foreach (GridColumn col in radGrid.MasterTableView.RenderColumns)
{
if (col.ColumnType == "GridBoundColumn")
{
if (col.UniqueName == "CardNumber")
{
string celltxt = dataItem[col.UniqueName].Text;
LinkButton link = new LinkButton();
link.Text = celltxt;
link.PostBackUrl = string.Format("CardDetails?CardNo={0}", link.Text);
dataItem[col.UniqueName].Controls.Clear();
dataItem[col.UniqueName].Controls.Add(link);
}
}
}
}
}
My issue is the postbackurl for the linkbutton is not dependent on a single/current cell value. Its depends on other cells as well. This can be something as given below:
link.PostBackUrl = string.Format("CardDetails?CardNo={0}?AccountID={1}", link.Text,?????);
I dont know how to get AccountID value which is there on the other cell and to my luck it can be invisible in many cases. When I try to access a dataItem["AccountID"] which is invisible gridboundcolumn, it is throwing "Cannot find a cell bound to column name 'AccountID'"} System.Exception {Telerik.Web.UI.GridException} exception.
Any ideas on this???
Is there anyway to give URL's something like this <a href="cardgroupview.aspx?id=<%# Eval("CardGroupID") %>"><%# Eval("CardGroupName")%></a> at the time of adding GridBoundColumns to radGrid at runtime.
Thanks a lot.
Mahesh
I have a radGrid to which I need to give links to few columns and I am doing as given below:
protected void radGrid_PreRender(object sender, EventArgs e)
{
foreach (GridDataItem dataItem in radGrid.Items)
{
foreach (GridColumn col in radGrid.MasterTableView.RenderColumns)
{
if (col.ColumnType == "GridBoundColumn")
{
if (col.UniqueName == "CardNumber")
{
string celltxt = dataItem[col.UniqueName].Text;
LinkButton link = new LinkButton();
link.Text = celltxt;
link.PostBackUrl = string.Format("CardDetails?CardNo={0}", link.Text);
dataItem[col.UniqueName].Controls.Clear();
dataItem[col.UniqueName].Controls.Add(link);
}
}
}
}
}
My issue is the postbackurl for the linkbutton is not dependent on a single/current cell value. Its depends on other cells as well. This can be something as given below:
link.PostBackUrl = string.Format("CardDetails?CardNo={0}?AccountID={1}", link.Text,?????);
I dont know how to get AccountID value which is there on the other cell and to my luck it can be invisible in many cases. When I try to access a dataItem["AccountID"] which is invisible gridboundcolumn, it is throwing "Cannot find a cell bound to column name 'AccountID'"} System.Exception {Telerik.Web.UI.GridException} exception.
Any ideas on this???
Is there anyway to give URL's something like this <a href="cardgroupview.aspx?id=<%# Eval("CardGroupID") %>"><%# Eval("CardGroupName")%></a> at the time of adding GridBoundColumns to radGrid at runtime.
Thanks a lot.
Mahesh