
Mahesh Babu
Top achievements
Rank 1
Mahesh Babu
asked on 28 Jul 2009, 09:04 AM
Hi,
I want to display GridBoundColumns as links for my radgrid. I want to perform this operation at runtime. Is there any way to do this?
Regards,
Mahesh
I want to display GridBoundColumns as links for my radgrid. I want to perform this operation at runtime. Is there any way to do this?
Regards,
Mahesh
5 Answers, 1 is accepted
0

Princy
Top achievements
Rank 2
answered on 28 Jul 2009, 09:27 AM
Hello Mahesh,
You can clear off all the existing controls from the bound columns in your grid and then add link buttons to the columns' control collection as shown below:
c#:
Thanks
Princy.
You can clear off all the existing controls from the bound columns in your grid and then add link buttons to the columns' control collection as shown below:
c#:
protected void RadGrid1_PreRender(object sender, EventArgs e) |
{ |
foreach(GridDataItem dataItem in RadGrid1.Items) |
{ |
foreach (GridColumn col in RadGrid1.MasterTableView.RenderColumns) |
{ |
if (col.ColumnType == "GridBoundColumn") |
{ |
string celltxt = dataItem[col.UniqueName].Text; |
LinkButton link = new LinkButton(); |
link.Text = celltxt; |
dataItem[col.UniqueName].Controls.Clear(); |
dataItem[col.UniqueName].Controls.Add(link); |
} |
} |
} |
} |
Thanks
Princy.
0

Mahesh Babu
Top achievements
Rank 1
answered on 28 Jul 2009, 10:00 AM
Its working. Thanks a lot.
0

Mahesh Babu
Top achievements
Rank 1
answered on 28 Jul 2009, 02:16 PM
Hi,
In my requirement, I need to give url to linkbutton which belong to multiple cells in the radgrid. How can I access other cell values at this moment???
Thanks,
Mahesh
In my requirement, I need to give url to linkbutton which belong to multiple cells in the radgrid. How can I access other cell values at this moment???
Thanks,
Mahesh
0

kencox
Top achievements
Rank 1
answered on 28 Jul 2009, 04:27 PM
Hello Princy,
I thought this example would accomplish what I need... to replace an Edit button with a Linkbutton containing the item number. However, clicking the Linkbutton doesn't have the same effect... the form does not go into Edit mode (indicated by the CommandName).
Here's the code I tried:
Thanks for any ideas.
Ken
I thought this example would accomplish what I need... to replace an Edit button with a Linkbutton containing the item number. However, clicking the Linkbutton doesn't have the same effect... the form does not go into Edit mode (indicated by the CommandName).
Here's the code I tried:
Protected Sub RadGrid1_PreRender _ |
(ByVal sender As Object, ByVal e As System.EventArgs) Handles RadGrid1.PreRender |
For Each dataItem As GridDataItem In RadGrid1.Items |
For Each col As GridColumn In RadGrid1.MasterTableView.RenderColumns |
If col.ColumnType = "GridBoundColumn" And col.UniqueName = "PartNumber" Then |
Dim celltxt As String = dataItem(col.UniqueName).Text |
Dim link As New LinkButton() |
link.Text = celltxt |
link.CommandName = "Edit" |
link.CausesValidation = False |
dataItem(col.UniqueName).Controls.Clear() |
dataItem(col.UniqueName).Controls.Add(link) |
End If |
Next |
Next |
End Sub |
Thanks for any ideas.
Ken
0

Anuroop
Top achievements
Rank 1
answered on 03 Feb 2012, 07:34 AM
I have the Approve button. if u select that button, the data present in the radgrid columns has to retrieve all the columns only if it has ID(ProductId). and the approved option in the radgrid should be 1(bit) so that it is approved. wat to do for this.Plz reply me asap.