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

[Solved] How would i do this with Telerik RadGrid

3 Answers 142 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Bob
Top achievements
Rank 1
Bob asked on 26 Sep 2009, 12:03 AM

 

Hello i need to convert from GridView to RadGrid, can anyone give me some suggestions on how to do this with RadGrid please?
IE, i basically would like to just loop thru each Grid Row and each Grid Column and if find that the Row.Cell approach is very intuitive, is there such an intuitive approach with the RadGrid?

Thanks very much for any pointers!

protected
void dgColumns_RowDataBound(object sender, GridViewRowEventArgs e)

 

{

 

try

 

{

 

if (e.Row.RowType == DataControlRowType.DataRow)

 

{

 

SelectedColumn col = AllSelCols[e.Row.RowIndex];

 

(e.Row.Cells[2].FindControl(

"txtAlias") as System.Web.UI.WebControls.TextBox).Text = col.Alias;

 

(e.Row.Cells[3].FindControl(

"chkOutput") as CheckBox).Checked = col.Output;

 

 

if (col.SortType != string.Empty)

 

{

(e.Row.Cells[4].FindControl(

"ddlSortType") as DropDownList).Items.FindByText(col.SortType).Selected = true;

 

}

(e.Row.Cells[5].FindControl(

"txtSortOrder") as System.Web.UI.WebControls.TextBox).Text = col.SortOrder;

 

}

}

 

catch (Exception ex)

 

{

lblErrorScriptManager.Visible =

true;

 

lblErrorScriptManager.Text = ex.Message;

}

}

3 Answers, 1 is accepted

Sort by
0
Bob
Top achievements
Rank 1
answered on 26 Sep 2009, 12:20 AM

I reposted to format the code better:

But basically i'm wondering how i could loop through the rows in a RadGrid similar to the way i'm looping through the rows of a GridView as i need to convert a GridView to a RadGrid and like the e.Row.Cell[2] approach.

Thanks for any pointers!
rc

protected
void dgColumns_RowDataBound(object sender, GridViewRowEventArgs e)

 

 

 

 

 

  if (e.Row.RowType == DataControlRowType.DataRow)

 

 

  {

 

         SelectedColumn col = AllSelCols[e.Row.RowIndex];

 

 

         (e.Row.Cells[2].FindControl(

"txtAlias") as System.Web.UI.WebControls.TextBox).Text = col.Alias;

 

 

         (e.Row.Cells[3].FindControl(

"chkOutput") as CheckBox).Checked = col.Output;

 

 

  }
}

 

 

0
Pavlina
Telerik team
answered on 28 Sep 2009, 08:03 AM
Hello Bob,

How this can be done with Telerik RadGrid control you can see from the following help article:
Accessing cells and rows

I hope this helps.

Greetings,
Pavlina
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Bob
Top achievements
Rank 1
answered on 28 Sep 2009, 11:10 AM
Thanks Pavina, yes that helps alot have a great week!
rc
Tags
Grid
Asked by
Bob
Top achievements
Rank 1
Answers by
Bob
Top achievements
Rank 1
Pavlina
Telerik team
Share this question
or