Click here to Skip to main content
15,891,423 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all i have a repeater control in which i have accordion.I cant access the value from database in accordion.In following code.In accordion i have Button2 and iam trying to assign a value as commandArgument but it always had null value.But if i write same code outside accordion it will works fine <%# DataBinder.Eval(Container.DataItem, "Wid")%>'
I have assigning data source in page_load event.All fields are visible outside the accordion but not in inside the Accordion.
code :
XML
<asp:Repeater ID="Repeater1" runat="server" onitemdatabound="Repeater1_ItemDataBound">
   <ItemTemplate>
   <asp:Image ID="Image1" runat="server" height="25px" Width="25px" ImageUrl='<%# DataBinder.Eval(Container.DataItem,"profilepic")%>' ToolTip='<%#DataBinder.Eval(Container.DataItem,"UserName")%>' />
   <%# DataBinder.Eval(Container.DataItem, "UserName") %>:
    <br/>
       <asp:Label ID="Label1" runat="server" Text=' <%# DataBinder.Eval(Container.DataItem, "WallStatus")%> ' ></asp:Label>
       <asp:Label ID="Label2" runat="server" Text=' <%# DataBinder.Eval(Container.DataItem, "Wid")%> ' Visible="true"></asp:Label><br />
       <div style="background-color:Gray;color:White;width:300px">
       <asp:Repeater ID="Repeater2" runat="server">
       <ItemTemplate><br />
            <asp:Image ID="Image1" runat="server" height="25px"
                ImageUrl='<%# DataBinder.Eval(Container.DataItem,"profilepic")%>'
                ToolTip='<%#DataBinder.Eval(Container.DataItem,"UserName")%>' Width="25px" />
            <%# DataBinder.Eval(Container.DataItem, "UserName")%>:
            <br />
            <%# DataBinder.Eval(Container.DataItem, "comment") %>
        </ItemTemplate>
        <SeparatorTemplate>
            <br />
            ------------------------------------------------------
            <br />
        </SeparatorTemplate>
       </asp:Repeater></div>
        <div style="background-color:Gray;color:White;width:300px" >
        <asp:Accordion ID="Accordion2" runat="server"  SelectedIndex="0" HeaderCssClass="HeaderCSS"
        ContentCssClass="accordionContent" AutoSize="None"
        FadeTransitions="true" TransitionDuration="250"
        FramesPerSecond="40" BorderColor="White"
              HeaderSelectedCssClass="HeaderSelectedCSS" Width="300px" OnItemCommand="Accordion_Click">
        <Panes>
        <asp:AccordionPane ID="AccordionPane0" runat="server" >
            <Header><b>+ Add Comment</b></Header>
            <Content>

            <asp:Panel ID="Panel3" runat="server">
            <asp:ImageButton ID="ImageButton2" runat="server" ImageUrl="~/Image/user_3.png" Height="50" Width="50" BorderColor="white" BorderStyle="Solid" BorderWidth="2px"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
            <asp:TextBox ID="TextBox2" runat="server" Height="46px" Width="185px" TextMode="MultiLine" Text=' <%# DataBinder.Eval(Container.DataItem, "WallStatus")%> '></asp:TextBox>
            <br />
            <asp:Button ID="Button2" runat="server" Text="Comment" OnClick="Comment_Click"  CausesValidation="false" CommandName="CommentButton" CommandArgument ='<%# DataBinder.Eval(Container.DataItem, "Wid")%>'/>
            </asp:Panel>
            </Content>
        </asp:AccordionPane>
        <asp:AccordionPane ID="AccordionPane1" runat="server">
            <Header><b>Close</b></Header>
        </asp:AccordionPane>
    </Panes>
       </asp:Accordion>
       </div>
   </ItemTemplate>
  <SeparatorTemplate>    <br />**************************************************  <br />
  </SeparatorTemplate>
        </asp:Repeater>
Posted
Updated 24-Jan-13 8:58am
v2
Comments
Ruchin Munjal 24-Jan-13 15:05pm    
can you share the code behind as well. You have a nested repeater. how are you binding the nested repeater?
sunil pol 25-Jan-13 13:33pm    
hi Ruchin,there is no problem with repeater within repeater.Even in single repeater, accordion not showing any data.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900