views:

21

answers:

1

hi is it possible to bind gridview inside of usercontrol from content page, if so how?

+2  A: 

Yes, the easiest way would be to expose the bind in the user control and then call it from your page.

//in user control, add this method
public void BindGrid()
{
    gvInnerGrid.DataBind();
}

//on your page
userControl.BindGrid();
Biff MaGriff
Hi it works thank you. I need to pass IQueryable object in order to bind GridView with data. And then to query this object inside of user control. Do you know how to do it?
German
You could use the same method to pass the data. Personally I would make a public property on the user control that exposes the grid's DataSource.ex.//user controlpublic object DataSource{get{return gvInnerGrid.DataSource;} set {gvInnerGrid.DataSource = value;}}
Biff MaGriff
Ok Thank you Biff it is working now )
German