I Have a drop down that allows the users to select 'other' if they do the drop down disappears and a text box and new drop down appear. What I would like is for this text box and drop down to be in the same position as the previous drop down, however at the minute the text box and new drop down are sitting below where the old drop down was. Any ideas how i can get this fixed? Both are in panels, when the user selects 'other' that panel disappears and the new one is visible.

When you set a panel to hidden, asp.net doesn't produce any client side HTML. Do you have any HTML between your panels? Run the page, look at the HTML source view in the browser.

when I run the page and select all the options the code in the source view is

 <div class="searchLabelContainer">
            <div class="searchLabel">
                &nbsp;
                <span id="MainContent_lblddlTime">Time:</span>
            </div>

            <div id="MainContent_pnlText">

                <div class="searchLabelContainer">
                    <div class="searchLabel">
                    </div>
                    &nbsp;
                    <span id="MainContent_lblHour">Hour(s)</span>
                    <input name="ctl00$MainContent$txtTime" type="text" maxlength="2" size="2" id="MainContent_txtTime" />
                    &nbsp;
                    <span id="MainContent_lblMin">Minute(s)</span>
                    <select name="ctl00$MainContent$ddlMin" id="MainContent_ddlMin" class="dropdownlist">
                <option value="0">Please Select...</option>
                <option value="0">0</option>
                <option value="15">15</option>
                <option value="30">30</option>
                <option value="45">45</option>

            </select>
                </div>

hi ,

I have an idea, why do you want to hide the previous dropdown and iterate a new one, rather you can just have conditional statement stating that if the user selects others it should iterate different data and a textbox or let it be the same data..

With panels, there is no need to hide specific elements. You can wrap the elements within a panel and on the server-side show/hide the appropriate grouping of HTML elements. This makes it easier to show/hide a grouping of elements. Its not even really showing/hiding. If you set the panel to visible the asp.net engine produces the HTML code. If you set it to false, no HTML is produced for the elemnets within the panel.

@coder91- So is there additional HTML code before line #1 that is creating that space you are talking about?

No the only code above is that for a different drop down list. There is no additional HTML code at all that I can see.

The problem was that the panel was sitting within a contaibner. When I removed it they are now sitting in the correct place.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.