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

Edit Form values loses value on postback following a cancelled event

1 Answer 306 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Matthew
Top achievements
Rank 1
Veteran
Matthew asked on 01 Nov 2020, 11:55 PM

I run into a scenario where controls in an EditForm loses their values when performing a postback, after recently cancelling an event.

 

For example:

1. Add new item (perform InitInsert), or edit existing item (perform Edit)

2. Make changes to control values

3. If adding, perform PerformInsert command, otherwise Update command

4. I have logic that would cancel the event (whether on ItemCommand or PerformInsert level) based on some values

5. Event cancelled, fire NeedDataSource in the background by default

6. On the EditForm, perform any postback (via cancel or attempt an insert/update again)

7. The control values within the EditForm lose their value

 

I thought if I cancelled on the ItemCommand level, the control values would persist, but this was not the case.

 

Any ideas on what I could do?

1 Answer, 1 is accepted

Sort by
0
Attila Antal
Telerik team
answered on 04 Nov 2020, 06:28 PM

Hi Matthew,

Values usually are lost if clearing them, or reminding the RadGrid.

If you only cancel the Insert event, the Insert will not happen, in fact, the insert form will stay open.

I have attached a Sample WebForms page with a Grid and I made it cancel the Insertion. If you import this into a Visual Studio project, you can run it right away. No database is or additional coding is required.

Check out how I did and if have a different scenario, modify this sample to replicate the issue and send it back to me. I will then test it on my end and check for the cause.

Regards,
Attila Antal
Progress Telerik

Virtual Classroom, the free self-paced technical training that gets you up to speed with Telerik and Kendo UI products quickly just got a fresh new look + new and improved content including a brand new Blazor course! Check it out at https://learn.telerik.com/.

Tags
Grid
Asked by
Matthew
Top achievements
Rank 1
Veteran
Answers by
Attila Antal
Telerik team
Share this question
or