.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Articles >> ASP.NET >> Post New Resource Bookmark and Share   

 Subscribe to Articles

Gridview in a repeater

Posted By:nishithraj       Posted Date: November 27, 2009    Points: 25    Category: ASP.NET    URL: http://www.dotnetspark.com  
 

Gridview in a repeater.

Grid view has some limitations. Main thing is we can show the data in columns. But my requirement was showing the first row as a heading. Rest of them as columns.

So I went for repeater inside a gridview


























In code behind we need to use gridview from the rowdatabound of repeater itself as shown below.


In code behind we need to use gridview from the rowdatabound of repeater itself as shown below.


protected void rptid_RowDataBound(object sender, RepeaterItemEventArgs e)
{
try
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
// we can't directly get the object of gridview here. Since it is residing in a repeater

GridView grdDetails = (GridView)e.Item.FindControl("grdDetails");
grdDetails.DataSource = objBL.GetData(objEmployee);
grdDetails.DataBind();
}


 












 Subscribe to Articles

     

Further Readings:

Responses

No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More Articles on C#, ASP.Net, Vb.Net, SQL Server and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend