Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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 9:50am
Edited 24-Jan-13 9:58am
v2
Comments
Ruchin Munjal at 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 at 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)

  Print Answers RSS
0 OriginalGriff 359
1 Maciej Los 290
2 Sergey Alexandrovich Kryukov 230
3 Shweta N Mishra 185
4 PIEBALDconsult 149
0 OriginalGriff 7,660
1 Sergey Alexandrovich Kryukov 7,072
2 DamithSL 5,604
3 Manas Bhardwaj 4,986
4 Maciej Los 4,760


Advertise | Privacy | Mobile
Web03 | 2.8.1411023.1 | Last Updated 24 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100