For Programmers: Free Programming Magazines  


Home > Archive > ASP .NET > November 2006 > Bind Repeater's DataRow to GridView's DataSource









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Bind Repeater's DataRow to GridView's DataSource
wardemon

2006-11-30, 7:03 pm

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();

}

}

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com