Using Telerik UI for ASP.Net Ajax R1 2019 with Visual Studio. Below link is my prototype and assuming Filtering is unabled in the Form.
I would like to Perform the Following:
1) End User Filter The Form to Find if the Row Exists based on Filter Conditions of 'First and Last Name'.
2) If no rows are found, they click 'Add new Record' Button.
3) When Insert Form Opens it should automatically Populate 'First and Last Name' in GridEditableItem from Filter Template Conditions ''First and Last Name'. Item #1 above. I came up with below codes from RadGrid1_ItemDataBound event.
4) Attached is my desired Screen Shot.
Any Help will be appreciated.
3 Answers, 1 is accepted
There are several ways you can auto-populate the Form controls during inserting a new record.
1. Setting the DefaultInsertValue property of the GridColumn in the markup:
2. Setting the DefaultInsertValue property of the GridColumn in the code behind using the PreRender event:
3. Access the required controls in Edit-Insert form and set their text accordingly:
Please let me know if I have missed something or if you have any questions.
Hi Attila, I am sorry to say that you misunderstood me. All I wanted is to populate Controls First/Last Names in RadGrid1_ItemDataBound event and if e.item is GridEditFormInsertItem from FilterItem search values First/Last Names.
1) If no records are found based on Filter Columns Conditions
2) Followed by users clicked 'Add new record' button.
Attached is my step by step work flow.
Also below is my source codes.
I modified the following:
1) Rad Grid Allow Filtering by Columns = true.
2) Page load event changed the filter conditions Texts to meaningful Text. i.e.
3) Inside RadCodeBlock1 Script in .aspx page reduced the filter item values.
I hope my explanation are clear.
Thank you for the additional information. I do have a better understanding on the requirements now.
Here is a demo GIF animation about the scenario I am understanding.
The above scenario was achieved using the following code snippets:
Assuming there are the Firstname and Lastname columns in the markup:
In the ItemDataBound event of the Grid:
Please let me know if I have missed something.