Question

In my content page, I am having a Telerik:RadWindow which will be used as a Popup I have an asp:Panel inside this findingPopup like below.

<Telerik:RadWindow ID="findingPopup" runat="server" Modal="true" VisibleStatusbar="false" VisibleTitlebar="false" VisibleOnPageLoad="false" AutoSize="true">
    <ContentTemplate>
        <asp:Panel ID="pCheckListType" runat="server"></asp:Panel>
    </ContentTemplate>
</Telerik:RadWindow>

Inside this Panel I dynamically add another asp:Panel which contains an HTML table and a DropDownList. It gets generated perfectly fine. I viewed the page source which is as below:

<div id="ctl00_cpBody_findingPopup_C_pCheckListType">               
<div id="ctl00_cpBody_findingPopup_C_pnlGenerated_51">
    <table id="ctl00_cpBody_findingPopup_C_tblGenerated_51" class="NoStyle">
        <tbody>
            <tr>
                <td>
                    <select name="ctl00$cpBody$findingPopup$C$ddList_51" id="ctl00_cpBody_findingPopup_C_ddList_51">
                        <option selected="selected" value="1" title="lt-master.app-tkn-flg">Face to Face</option>
                        <option value="2">Mail</option>
                        <option value="3">Phone</option>
                        <option value="4">Internet</option>
                    </select>
                </td>
            </tr>
        </tbody>
    </table>
</div>

The problem is, I am not able to find the DropDownList using the Panel.FindControl as well as I looked at FindControlRecursive question. But I do not get the DropDownList even with starting the root element as Page. Could any one help me to understand what am I doing wrong?

EDIT: I guess I know the reason. The dynamically created elements get disappeared while postback. Any one has any suggestions on how to get the value of dropdownlist when the button is clicked?

Was it helpful?

Solution

I was actually recreating the controls. The problem was with the Ids. I had to assign them some id numbers which should remain the same while post back. That fixed my problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top