开发者

Dynamic Column that contains a Repeater

How would I go about doing this programatically?

I can do this just fine declaratively, using a template column and then using so开发者_开发技巧mething like this:

    ...
<TemplateGridColumn>
    <ItemTemplate>
       <div>
          <asp:Image ID="groupImg" CssClass="groupImg" runat="server"/>
          <asp:Repeater ID="groupItemRpt" runat="server">
             <HeaderTemplate>
                <ul class="groupItemList">
             </HeaderTemplate>
             <ItemTemplate>
                <li>
                   <asp:Image ID="itemImg" runat="server" />
                   <asp:HiddenField ID="itemValue" runat="server" />
                </li>
             </ItemTemplate>
             <FooterTemplate>
                </ul>
             </FooterTemplate>
          </asp:Repeater>
       </div>
    </ItemTemplate>
    </TemplateGridColumn>
...

I am dynamically creating this grid based on the data, so I'm already added columns with one set of controls. But now I need to figure out how to show multiple images, which expand/contract if the groupImg image control is clicked (i just toggle the ul) ..

Can anyone point me in the right direction? Thanks.


This might not be the cleanest solution, but take a look at the FindControl() method. You can use it to loop though the grid items and find the repeater by its ID.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜