Bind Gridview inside Data List view
Some time we need to display content in tabular form in Data list. So we can use gridview inside in Datalist.
Here we have to define the DataList_ItemDataBound event and find control of our gridview at the time of ItemDataBound event of DataList. After finding control of gridview in GridView type object, we have to pass datasource and bind datasource with this object.
Protected Sub DLOrder_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs) Handles DLOrder.ItemDataBound
Dim grd As GridView = CType(e.Item.FindControl("GridView1"), GridView)
Dim DtItem As DataTable = DataBase.GetDataTable("Sql Query")
grd.DataSource = DtItem
grd.DataBind()
End Sub
0 Comment(s)