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

data type in radgrid

2 Answers 136 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Zahra
Top achievements
Rank 1
Zahra asked on 09 Feb 2012, 05:38 AM


hi
i have a radgridview that it full by a dataset while load my form.
it's fields are number, Id,name,familly that type of number field & Id field is "int" into sqlserver table,now i want number & Id field be a linkable cell while loads my  form, and i want while click on the Id field (1,2,3,.....) or click on the  number  field (1,2,3,......)  open a new form or show a message & other things,
plz help me,
already thanks a lot

2 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 09 Feb 2012, 06:45 AM
Hello Zahra,

One suggestion is you can access the cell and assign HyperLink dynamically. In the case of adding controls to the cells of GridBoundColumn,you cannot use ItemCreated only, but a combination of both ItemCreated and ItemDataBound.Here is the sample code.
C#:
protected void RadGrid1_ItemCreated(object sender, GridItemEventArgs e)
{
 if (e.Item is  GridDataItem)
 {
   GridDataItem item = (GridDataItem)e.Item;
   TableCell cell = (TableCell)item["UniqueName"];
   HyperLink hyperLink= new HyperLink ();
   hyperLink.Text = cell.Text;
   hyperLink.NavigateUrl = "page.aspx";
   hyperLink.ID = "hyperLink1";      
   cell.Controls.Add(hyperLink);
 }
}
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
 if (e.Item is GridDataItem)
 {
  GridDataItem item = (GridDataItem)e.Item;
   TableCell cell = (TableCell)item["UniqueName"];
   HyperLink hyperLink= new HyperLink ();
   hyperLink.Text = cell.Text;
   hyperLink.NavigateUrl = "page.aspx";
   hyperLink.ID = "hyperLink1";      
   cell.Controls.Add(hyperLink);
 }
}

-Shinu.
0
Zahra
Top achievements
Rank 1
answered on 09 Feb 2012, 06:52 AM
hi shinu
very thanks
but ,i don't use asp application,i use windows app.
this matter don't solve in windows application?
merc.again
Tags
Grid
Asked by
Zahra
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Zahra
Top achievements
Rank 1
Share this question
or