Last post Jul 18, 2018 02:48 AM by Yohann Lu
Jul 14, 2018 07:19 PM|mz1378|LINK
Suppose we have a User Control that contains a form (a series of form controls and a save button), We design an Event in this UC that every time the save button clicked and result was successful the outside world (an outside page method) is informed and
if Save is not successful an error message displays inside User Control.
Now we want to wrap this User Control inside a UpdatePanel and place it inside a Repeater (or GridView) and connect the User Control's Event to a Page Method.
Is it possible to change one of User Control's Contents and push Save button and Expect that, if Save was unsuccessful only relevant User Control inside its wrapping UpdatePanel is updated and an error message shows inside of it? and can we expect if Save
was successful only the connected Page method is triggered and for example (inside of this method): we make the entire repeater Data Bound and then call "update" on wrapping Update panel (another outside UpdatePanel around the repeater not the ones inside
Jul 15, 2018 03:16 PM|mgebhard|LINK
Web forms allows only one HTML form so the design will not work with multiple forms. Remove the multi-form idea and user control. IMHO, the user control is not needed because you can simply take advantage of server control data binding which will render
multiple server controls automatically.
I would start with the basic design and if you feel that encapsulation is needed (User Control) because the user control is used on other pages then refactor after you get the basic design working. IMO, if the user control is not used in other pages then
a user control is just over engineering.
Jul 15, 2018 03:53 PM|mz1378|LINK
Jul 18, 2018 02:48 AM|Yohann Lu|LINK
I don't fully understand what you mean according to your description. I know that you want to do something with a User Control that contains a form. And you describe the process of the scenario you want. But I don’t understand what your purpose is.
You need to try your own thoughts and find out whether it is feasible or not.