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

Grid : selected row and FindControl

2 Answers 88 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Steve
Top achievements
Rank 1
Steve asked on 30 Apr 2012, 11:43 AM
Hello,
I am binding the Grid inside a loadHeader method and inside that method, I need to call an event called raIseChangedEvent. Inside raiseChangedEvenet, I need to find the label control inside the gridview and get the value of it. I don't know how to do this. below is my code

public loadHeader()
{

    RadGrid_Header.DataSource = HeaderList;
         RadGrid_Header.DataBind();
         RaiseChangedEvent();

}
protected void RaiseChangedEvent()
{
       // This is what i did with asp.net gridview
       grd_view_tracking.SelectedIndex = 0;
       GridViewRow selected_row = grd_view_tracking.SelectedRow;
      string job_seq_text_val = ((Label)selected_row.FindControl("lbl_job_seq")).Text;
}

How can I get the value of job_seq_text_val  in RadGrid.

2 Answers, 1 is accepted

Sort by
0
Accepted
Princy
Top achievements
Rank 2
answered on 30 Apr 2012, 12:30 PM
Hello Steve,

Try accessing the label as shown below.
C#:
protected void RaiseChangedEvent()
{
   foreach (GridDataItem item in RadGrid1.SelectedItems)
  {
      Label lbl = (Label)item.FindControl("lbl_job_seq");
     string value = lbl.Text;
   }
 }

Thanks,
Princy.
0
Steve
Top achievements
Rank 1
answered on 04 May 2012, 06:21 AM
Thank you Princy
Tags
Grid
Asked by
Steve
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Steve
Top achievements
Rank 1
Share this question
or