Click here to Skip to main content
Sign Up to vote bad
good
See more: C#ASP.NET
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 :
<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 24 Jan '13 - 8:50
Edited 24 Jan '13 - 8:58

Comments
Ruchin Munjal - 24 Jan '13 - 15:05
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:33
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)

  Print Answers RSS
Your Filters
Interested
Ignored
     
0 Sergey Alexandrovich Kryukov 239
1 OriginalGriff 188
2 Mahesh Bailwal 149
3 Maciej Los 140
4 Tadit Dash 128
0 Sergey Alexandrovich Kryukov 10,214
1 OriginalGriff 7,819
2 CPallini 4,181
3 Rohan Leuva 3,522
4 Maciej Los 3,089


Advertise | Privacy | Mobile
Web04 | 2.6.130523.1 | Last Updated 24 Jan 2013
Copyright © CodeProject, 1999-2013
All Rights Reserved. Terms of Use
Layout: fixed | fluid