Bind Repeater's DataRow to GridView's DataSource

W

wardemon

Hi All,
I was just wondering if the following is possible? To bind a
GridView's datasource to the Repeater's current DataRow value.

I tried creating a dataset, then load the datarowview inside it,
however, this method would require a lot of things to do like, create a
table, create columns for it, etc..

I was wondering if there is more of a direct way to feed GridView's
..DataSouce to the Repeater's e.Item.ItemType's data.

Thanks,
Henry :)




public void Main_OnItemDataBound(object sender,
RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
ListItemType.AlternatingItem)
{

((GridView)e.Item.FindControl("gvwColumnDescriptions")).DataSource =
((DataRowView)e.Item.DataItem);

((GridView)e.Item.FindControl("gvwColumnDescriptions")).DataBind();

}

}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top