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

AllowAutomaticInserts and invisible column

3 Answers 63 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Marko Gluhak
Top achievements
Rank 1
Marko Gluhak asked on 24 Feb 2012, 09:38 PM
Hi,

I have grid that uses OpenAccessLinqDataSource with automatic insert, update and delete. I'm trying to implement insert but with following scenario.

Data table (as class) has 4 properties. ID, IdFirm, Number and Activity. I have set invisible property for ID and IdFirm colum. For ID is clear why I hide it. As for IdFirm I dont wont to display it because it must be connected to some othe class on page and user MUST NOT enter that information.

How to implement automatic insert and intersept that call to add IdFirm property to object and then save it database.

I use command item (AddNewRecordButton)

Marko

3 Answers, 1 is accepted

Sort by
0
Marko Gluhak
Top achievements
Rank 1
answered on 24 Feb 2012, 09:51 PM
I have found solution but I dont know is this best practice.

I saw that OpenAccessLinqDataSource has event handler OnInserting so I use it to assign IdFirm property inside. After that it works ok.
0
Accepted
Antonio Stoilkov
Telerik team
answered on 29 Feb 2012, 03:32 PM
Hello Marko,

Setting RadGrid column Visible property to false is intended for data fields that are auto generated in the database. In cases when you need to set the data field manually the DataSource Inserting event is appropriate for the case. I will be happy to assist you if you have further questions.

Kind regards,
Antonio Stoilkov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Marko Gluhak
Top achievements
Rank 1
answered on 29 Feb 2012, 05:24 PM
As I write in my previous post I manage to do it with inserting event but I was not sure if that right way. Now you confirmd it is so I'll mark it solved.
Thank you!

Tags
Grid
Asked by
Marko Gluhak
Top achievements
Rank 1
Answers by
Marko Gluhak
Top achievements
Rank 1
Antonio Stoilkov
Telerik team
Share this question
or