I want to bind gridview which is inside a repeater. My code is
<asp:Repeater ID="rep_UnAssignComps" runat="server">
<ItemTemplate>
<asp:GridView ID="rep_DataSimilarToBacthid" runat="server" Style="text-align: center;
width: 375px;" AutoGenerateColumns="false">
<Columns>
<asp:BoundField HeaderText="Test" DataField="Test" />
</Columns>
</asp:GridView>
</ItemTemplate>
</asp:Repeater>
you have to fire repeater's ItemDataBound event. In which you have to find gridview then bind it as following:-
If e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType = ListItemType.AlternatingItem Then
Dim grd As GridView = TryCast(e.Item.FindControl("rep_DataSimilarToBacthid"), GridView)
grd.DataSource = dt
grd.DataBind()
end if
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With