Community discussion forum

Not able to read the dynamic controls

Tags: asp.net, db India
  • 2 months ago

    Hi,

    I have created some dynamic controls in page load and added to an existing asp:Table

    Its displaying in the page ( the page contains 3 tabs , this controls are added in one of the tab)

    If I click on another tab , I am trying to save the data in this dynamic controls .

    But not able to access it.

    </P> <P>This panel is a part of one table.</P> <P>&lt;asp:Panel ID="pStudySpecific" runat="server" EnableViewState="true" &gt; </P> <P>&lt;%--&lt;table width="100%" &gt; --%&gt; </P> <P>&lt;tr&gt;</P> <P>&lt;td&gt; </P> <P>&lt;asp:Table width="100%" border="1" runat="server" id="tblTimeZone" enableviewstate="true" &gt; </P> <P>&lt;asp:TableRow&gt;</P> <P>&lt;asp:TableCell&gt;</P> <P>&lt;asp:Table ID="tblTimeZones" runat="server" border="0" EnableViewState="true" &gt; </P> <P>&lt;asp:TableHeaderRow HorizontalAlign="Left"&gt;</P> <P>&lt;asp:TableHeaderCell HorizontalAlign="Left"&gt;</P> <P>&lt;asp:Label runat="server" ID="lblTimeZoneDetails" Text="TimeZone" SkinID="GroupTitleSkin"&gt;&lt;/asp:Label&gt;</P> <P>&lt;/asp:TableHeaderCell&gt;</P> <P>&lt;/asp:TableHeaderRow&gt; </P> <P>&lt;/asp:Table&gt;</P> <P>&lt;/asp:TableCell&gt;</P> <P>&lt;/asp:TableRow&gt;</P> <P>&lt;/asp:Table&gt;</P> <P>&lt;/td&gt;</P> <P>&lt;/tr&gt; </P> <P>&lt;/panel&gt;</P> <P>1. page load create controls and added to tblTimeZones.</P> <P mce_keep="true">&nbsp;</P> <P>2.Tab( link button click event)</P> <P>I tried to access control</P> <P>ContentPlaceHolder cphDetails = (ContentPlaceHolder)this.Master.FindControl("cphDetails");</P> <P>Table tblTimeZon = (Table)cphDetails.FindControl("tblTimeZones");</P> <P>till here its fine ,I am getting the values.</P> <P>DropDownList drpLstControl = (DropDownList)tblTimeZon.FindControl("drpLst" + objCustomField.DatabaseField);</P> <P>In the above line its giving null value.</P> <P>

    This all controls are in an update panel and content place holder.

    Please help.

  • Advertisement

    Simply the fastest line-level profiler for .NET ever

    “The low overhead means it has minimal impact on the execution of my program”
    Mark Everest, Development Team Leader, Renault F1 Team Ltd.

    Try out the new ANTS Profiler 4 for yourself. Download your 14-day trial now

  • 2 months ago

    Hi Pradeep,

    -Try to count no. of controls on your panel using a loop.

    - then check whether the control found is a textbox or not, if so, then get the value of the same.

     Regards,

    Royal

     

Post a reply

Enter your message below

Sign in or Join us (it's free).