Rupa

Rupa

  • NA
  • 1
  • 1.8k

Accessing data field from outer repeater, Nested Repeater

Jan 29 2013 5:39 PM
Hi,

I have following code in my ASCX control file..

<div>
    <ul>
        <asp:Repeater ID="outerRep" runat="server" OnItemDataBound="outerRep_ItemDataBound">
            <ItemTemplate>
                <li>
                    <asp:HyperLink Font-Size="Large" Font-Bold="true" ID="lblCategoryName" runat="server"
                        Text='<%# Eval("Cat_Name") %>' NavigateUrl='<%# string.Format("~/Coupons-Specials-Deals/Michigan/{0}.aspx",Eval("Cat_Name").ToString().Replace(" & ","-")) %>'/>
                </li>
                <ul>
                <asp:Repeater ID="innerRep" runat="server" >
                    <ItemTemplate>
                        <li style="background-color: AliceBlue">
                            <asp:HyperLink ID="hlSubCatName" runat="server" 
                            Text='<%# Eval("SubCat_Name")%>' NavigateUrl='<%# string.Format("~/Coupons-Specials-Deals/Michigan/{0}.aspx",Eval("SubCat_Name").ToString().Replace(" & ","-")) %>'  />
                      </li>
                    </ItemTemplate>
                </asp:Repeater>    
                </ul>
                </ItemTemplate>
                </asp:Repeater>
                </ul>
    </div>

I want to generate URL as below, When i click on subcategory:-

~/Coupons-Specials-Deals/Michigan/CategoryName/SubCategoryName.aspx

But when i am writting Eval("Cat_Name") inside , InnerRep its giving me an error

Can anyone please suggest me solution on this?

Thanks!

Reply Quote  Delete