Update Panel Problem

curlydog

Well-known member
Joined
Jul 5, 2010
Messages
50
Programming Experience
Beginner
Hi, I have a form with a drop down list that is bound from a database. The last option in the ddl is "Add another Type", in order that the user can add to the list.

My idea was to have a panel which is invisible. If the user chooses "Add another type" the panel becomes visible. They enter the value they want to add into a textbox on the panel and on clicking a submit button (also on the panel) the value is added to the database, the panel disappears and the ddl is rebound.

Initially I got the page working fine, but without the ddl being rebound. I thought rather than refreshing the whole page, I would put the ddl into an updatePanel and refresh it only.

When I now select "Add another type" from the ddl, nothing changes on the page. The panel remains invisible. From debugging messages I have put into the code, I can see that there is a page postback and I can see that the ddl. selectedIndexChanged event if firing, but the code within it (panel1.visible=true) doesn't appear to be executing.
 
What is layout? You say DDL trigger is in UpdatePanel, is invisible Panel also in same UpdatePanel? Only contents in UpdatePanel is updated normally.
 
Sorry,
the invisible panel is not in the same update panel as the ddl.Essentially my page has three columns. The ddl and the updatepanel on which it sits are in the middle column. When the user selects "Add another type" from the ddl, the invisible panel should appear in the right hand column, so the user user can add another type. The trigger for the updatepanel refreshing is the "Submit" button which sits in the invisible panel (although by this time it should be visible.

Whilst the updatePanel and the invisible panel are completely separate, and on different parts of the page, they are both on the same form, if this makes an difference.
 
The whole point of UpdatePanel is that normally you only want that part to update, and nothing else. For changes to appear you must either put that in a UpdatePanel and trigger that to refresh also, or trigger whole page to refresh. There are several approaches depending on what you really want to happen.
 
Well, based on my descriptions above. If the user selects "Add another type" from the ddl, then I want the whole page to refresh in order that the invisible panel becomes visible. Then once the user has added another type in the textbox on the invisible panel and clicked the submit button (again on the invisible panel), I want the ddl to refresh.

Having said that, when the submit button is clicked I want the invisible panel to become invisible again. Because I'm updating two seperate parts of the page (the ddl and the invisible panel) I'd probably be better of refreshing the whole page again.
 
Back
Top