Chat LIVE With Programming Experts! There Are 23 Online Right Now...

Welcome to Dream.In.Code
Become a ASP.NET Expert!

Join 244,296 ASP.NET Programmers for FREE! Get instant access to thousands of ASP.NET experts, tutorials, code snippets, and more! There are 872 people online right now. Registration is fast and FREE... Join Now!




GridView Inside a datalist

 
Reply to this topicStart new topic

GridView Inside a datalist, how to take grid view inside a datalist

kris036
27 Nov, 2008 - 04:29 AM
Post #1

New D.I.C Head
*

Joined: 27 Nov, 2008
Posts: 2

<asp:DataList ID="dLProducts" runat="server" RepeatColumns="3" RepeatDirection="Horizontal" ShowFooter="False" ShowHeader="False" ItemStyle-HorizontalAlign="Center" ItemStyle-VerticalAlign=Top Width="500px" BorderWidth="1" BorderColor="Gray">

<ItemTemplate>

<table border="0" cellspacing="0" cellpadding="0" bordercolor="#e0e0e0" height="150px">

<tr>
<td align=center valign=middle background="images/body_bg.jpg" height="140px" width="130px">
<a href='ProductDisplay.aspx?pid=<%#DataBinder.Eval(Container.DataItem ,"pcatid")%>') target="_blank">
<img border="0" name=<%# DataBinder.Eval(Container.DataItem, "pBigImg") %> src='Uploads/<%# DataBinder.Eval(Container.DataItem,"pSmallImg") %>' />
</a>

</td>
<tr>
</tr>
</tr>
<tr>

<td align=center valign=top background="images/body_bg.jpg" height="10px" width="130px">
<a class="product" href='ProductDisplay.aspx?pid=<%#DataBinder.Eval(Container.DataItem ,"pcatid")%>' target="_blank"> <b><%#DataBinder.Eval(Container.DataItem ,"pName") %></b></a>
</td>
</tr>

<asp:DataGrid id="grdSubCategories" runat="server" AutoGenerateColumns="False" GridLines=None ShowHeader="False" >
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<table>
<tr>
<td align=center valign=top>
<a class="Category" href="Products.aspx?refid=<%#DataBinder.Eval(Container.DataItem,"pCatid") %>" >
<%#DataBinder.Eval(Container.DataItem,"pTitle") %> </font></td></tr></table>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>

<tr>
<td align=center valign="middle">
&nbsp;</td>
</tr>
</table>

</ItemTemplate>
<ItemStyle HorizontalAlign="Center" VerticalAlign="Top" />

</asp:DataList>




mycode behind code is
------------------------------------------



protected void dLProducts_ItemDataBound(object sender, DataListItemEventArgs e)
{
GridView grid = e.Item.FindControl("grdSubCategories")as GridView;
sQuery = "select *from tbl_ProductsMenu";
ds = objData.getDataSet(sQuery);
grdSubCategories.DataSource = ds;
grdSubCategories.DataBind();

}

error iam getting is grdId I.e grdSubCategories is does not exists in current context.


please do help

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic

Time is now: 7/4/09 04:36PM

Live ASP.NET Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

ASP.NET Tutorials

Reference Sheets

ASP.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month