Monday, March 26, 2012

updating only portion of a User control

Hi,

I Have an application Where I am dyanmically Loading User controls in a Main Page Content area(in an Update Panel)

And Each user control has its own update panel. for Example I have a List box and a text box and the Text box is in an update panel

And when the user select an item in the list box i need to update the text box upadate panel.

But the problem is since all these controls are in a user control and the user control loads in a place holder in an update panel in my main page.

To get the events of the user control child controls i need to load it again while asynchrounous post back

ie When user selects a menu item i am loading my user control into a place holder in an update panel in the main page.

and when the user clicks on the list box in my user control to get the selected index changed event i need to load the user control again

in my cs code. to the place holder . but i am only updating the text box in my user control. and so i placed that in an update panel.

but the problem is since my user control is inside an update panel in my main page the whole user control get refreshed.

I put the update mode of my main page update panel as conditional and when the user double clicks on the list box i load the user control in the palce holder so that i will get the events but i didn't update the main update panel. I did call only update for the update panel for the text box(which is in my user control)

but still my whole user controls get refeshed . Is there any solution for this

Thanks and regards

jereesh

Where the control that make posteback is located , is it inside your main update panel ?

if yes so you have to set "ChildrenAsTriggers" of your main update panel to false.

please let us know about your aspx code


HiI have a Main page where there is an update panel( where a place holder exists )which is made as conditionalAnd I have user controls(ascx) which are dynamically loaded into this update panel-into the place holder-(when user clicks on different menu items in main page. And inside each user Control there is an update panel where all child controls are placedand I may have update panels for individual controls in user controlfor example in one of my user control I have a list box and a text box and when i double click on the list box i need to change the text box value so i kept the text box inside an update Panel. but the problem is when i click on the list box in a user control if i need to get the event(selected indexchnaged) for that user control i need to load it again to the place holder in the cs file(Main.aspx.cs), ie if may user control name is search.ascxi am usong LoadControl method and adding it to the placeholder in my main page(this should happen each time when any postback occurs because of an event for a child control in the user control- then only i will get its events).I kept all update panel's update mode as conditional. and I will call only update for the update panelwhre my text box exists ( ie the update panel inside my user control). I only call Update for my main update panelonly when I need to load another user control ie when the user selects another menu item from the main page. mainupdatepanel -- Upadated only when new user control is to be loade usercontrolupdatepanel - Updated conditionally usercontrolchildcontrolUpdatepanel-- updates conditionallyThanks and Regards

Hi,

You have to set "ChildrenAsTriggers" of your main update panel to false.

Best Regards,

No comments:

Post a Comment