Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
We using Ajax Accordion Pane in that we have requirement that a textbox is present in header panel so user can edit the textbox and while click button which is present in Content panel i need to get that textbox value in .cs.

My .aspx
XML
  <cc1:Accordion ID="accRcvDetails" runat="server" SelectedIndex="-1" ContentCssClass="accordion-content" RequireOpenedPane="false" HeaderCssClass="accordion-header"
                                       HeaderSelectedCssClass="accordionSelected" OnItemCommand="accRcvDetails_ItemCommand" OnItemDataBound="accRcvDetails_ItemDataBound">

                                       <HeaderTemplate>

                                                   <asp:TextBox runat="server" ID="txtIdentified" Width="20%" value='<%#Eval("IDENTIFIEDQTY")%>' />

  </HeaderTemplate>

      <ContentTemplate>
<asp:Button ID="btnSave" CssClass="searchbutton Accbtnsave" runat="server" CommandName="Save" Text="Save" ValidationGroup='<%# Eval("GroupId") %>'/>


                                       </ContentTemplate>


                                   </cc1:Accordion>


The code Behind.
C#
protected void accRcvDetails_ItemCommand(object sender, CommandEventArgs e)
{
  if (e.CommandName == "Save")
  {
    TextBox txtIdentified = (TextBox)((AccordionCommandEventArgs)e).Container.FindControl("txtIdentified");
  } /* here txtidentified is null*/
}



I tried lot. but no luck. We binding accordion panal dynamically from dataset.
Posted
Updated 9-Nov-14 3:15am
v2
Comments
Sinisa Hajnal 7-Nov-14 3:38am    
Your textbox has runat="server". You should be able to access it just by txtIdentified.Text = "New Text".

Your container is probably ContentTemplate, not the accordion so txtIdentified will not be found in it. You should call FindControl on the HeaderTemplate.

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