Note that there are some explanatory texts on larger screens.

plurals
  1. POAccess Parent Page Control in Child User Control
    primarykey
    data
    text
    <p>I have an aspx page in which I have Ajax UpdatePanel which has a AJAX Tabcontainer which has 5 tab. In First tab I have a DropDownList for ProductID. In the second tab I have used a UserControl whose parameter needs to be reflected based on productID. I want to Access the DropDownList ProductID in the user control which I am not getting. Part of my code is</p> <pre><code>DropDownList IDList = (DropDownList)(this.Parent.FindControl("ProductID"); </code></pre> <p>this is not working and I am getting NULL. I also have Tried</p> <pre><code>DropDownList IDList = (DropDownList)(this.Page.FindControl("ProductID"); </code></pre> <p>Please tell me how I can do this.</p> <p>As asked Part of necessary code is</p> <pre><code>&lt;asp:UpdatePanel ID="UpdatePanelTankFormula" runat="server"&gt; &lt;ContentTemplate&gt; &lt;asp:tabcontainer id="TabContainerTankFormula" AutoPostBack="true" runat="server" OnClientActiveTabChanged="clientActiveTabChanged" activetabindex="0" style="width:100%;"&gt; &lt;asp:TabPanel ID="InputDataTab" runat="server" HeaderText="Data Input"&gt; &lt;ContentTemplate&gt; &lt;asp:DropDownList id="TankNameCombo" DataTextField="TankName" runat="server" AutoPostBack="true" DataValueField="customertankid" width="200px" onclick="javascript:SetHiddenField();"&gt; &lt;/asp:DropDownList&gt; &lt;/ContentTemplate&gt; &lt;/asp:TabPanel&gt; &lt;asp:TabPanel ID="LacticAcidAdditionTab" runat="server" HeaderText="Lactic Acid Addition"&gt; &lt;ContentTemplate&gt; //My user control &lt;UC:TankNote runat="server" ID="LaticTankNotesUC" GetNoteType="LAC" MEQMode="False"&gt;&lt;/UC:TankNote&gt; &lt;/ContentTemplate&gt; &lt;/asp:TabPanel&gt; &lt;/asp:tabcontainer&gt; &lt;ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; </code></pre> <p>Now in the Code Behind of this User Control I want to access this DropDownList, which I am not getting. For the fix I have define a Public function that return the value of this list. But its a fix not solution.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload