This is a migrated thread and some comments may be shown as answers.

RadGrid LinkColumn..

2 Answers 48 Views
Grid
This is a migrated thread and some comments may be shown as answers.
raaj
Top achievements
Rank 1
raaj asked on 30 Sep 2010, 03:03 PM
Team

I'm binding dynamically generated DataTable as a Datasource to RadGrid.
Am getting the result as below...

School Name 2007 2007 2008 2008 2009 2009
  Payroll Payroll Tax Payroll Payroll Tax Payroll Payroll Tax
Allen 989 3424 23423 535 5565 43534
Akron 95456 23423 23423 456545 34534 3423
Alphretta I 45454 2342 2332 23423 34534 2324

my requirement is I want to make the 2007 Payroll, 2008 Payroll and 2009 Payroll columns are Link (Not all the Columns)
By click that I want to open an another Page....
How can I achieve this..am not using GridboundColumn in aspx page..
I want to achieve this thru aspx.cs (codebehind).

Pls. help me out.

Thanks.

2 Answers, 1 is accepted

Sort by
0
Radoslav
Telerik team
answered on 01 Oct 2010, 11:25 AM
Hello Rajesh,

Please try the following code snippet and let me know if it helps you:
void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
   if (e.Item is GridHeaderItem)
   {
       GridHeaderItem item = e.Item as GridHeaderItem;
       string text = (item["Title"].Controls[0] as GridTextButton).Text;
       item["ColumnUniqueName"].Controls.Clear();
       HyperLink link = new HyperLink();
       link.Text  = text;
       link.NavigateUrl = "http://www.telerik.com";
       item["ColumnUniqueName"].Controls.Add(link);
    }
}

The ColumnUniqueName is the unique name of the column which header's text needs to be a link.

Kind regards,
Radoslav
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Shinu
Top achievements
Rank 2
answered on 01 Oct 2010, 11:30 AM
Hello,


One suggestion is in the ItemCreated event, clear the the cell text as null and dynamically create new control and add to the grid cell.


-Shinu.
Tags
Grid
Asked by
raaj
Top achievements
Rank 1
Answers by
Radoslav
Telerik team
Shinu
Top achievements
Rank 2
Share this question
or