This is a migrated thread and some comments may be shown as answers.

WebUserControl - Leave form open after postback

4 Answers 97 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Richard Thurgood
Top achievements
Rank 1
Richard Thurgood asked on 17 Sep 2008, 11:46 AM
Hello, I've created a grid web user control to display a list of records. I bind the grid using the NeedDataSource event to a data table directly (in other words, I'm not using the data source controls).  I ste AutoGenerateEditColumn="True" so I get an edit button for each row.  I've made the grid call a web user control as the detail form by setting EditFormType="WebUserControl" and when "edit" is clicked, I display that form. The form has a save and a cancel button on it. Everything works fine as long as there is no error when saving.

Here's the issue: When I click "save" on the detail form, the form closes and the grid updates, BUT if there is an error, I want to display the error and leave the form open.  (BTW - I'm handling displaying the error so I'm not concerned about that part) I looked at some samples you had but only found those that are NOT using a custom web user control and in these examples.

Can you please tell me how to leave my detail form open in the event of an [handled] error when saving the data?

4 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 17 Sep 2008, 01:11 PM
Hello Richard,

In the ItemCommand event check for the CommandName and set the e.Canceled property to true to keep the detail form open.

Thanks,
Princy.
0
Richard Thurgood
Top achievements
Rank 1
answered on 17 Sep 2008, 02:52 PM
Yeah, after posting, I realized that and I added a static property to my base class. I set this property (EditSuccessful) to true in the form control when edits are successful. Then, I check this flag in the ItemCommand event of the grid.

Works great.

Thanks.
0
David Brown
Top achievements
Rank 2
answered on 09 Dec 2008, 12:56 AM
Hi -,

I have the inverse issue.  Within a RadMultiPage control, I have two web user controls: the first is a list of users, the second is a list of orders.  Each has its own web user control to handle the editing of the selected record. Each list displays the items correctly.  Pressing the edit button displays the web user control (edit form) below the selected record.  On each form is a set of buttons - Approve, Deny, and Cancel.  The RenderSelectedPageOnly attribute is set to true.

When editing a user, the grid and edit form behave correctly.  Pressing the cancel button cancels the edits, closes the edit form, and rolls up the grid.  Pressing either the Approve or Deny buttons causes the corresponding action to be fired in the code-behind on the form (the form handles the button events), closes the edit form, and rolls up the grid.

When editing an order, the controls do not behave correctly.  Pressing the cancel button does not close the form.  Pressing either the Approve or Deny buttons causes the corresponding action to be fired in the code-behind on the form (again, the form handles the button events), but the edit form is not closed.

Any ideas what my cause this or how to get the Orders grid / edit form to behave properly?

Thanks,
David


0
Yavor
Telerik team
answered on 09 Dec 2008, 06:17 AM
Hello David,

Based on the supplied information, it is hard to determine what is causing the unwanted behavior. If the issue persists at your end, you can open a formal support ticket, and send us a small project sample, demonstrating the problem, for further review.

Best wishes,
Yavor
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Richard Thurgood
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Richard Thurgood
Top achievements
Rank 1
David Brown
Top achievements
Rank 2
Yavor
Telerik team
Share this question
or