


Inside this JavaScript function, a loop will be executed over the GridView Rows and the Cell values will be compared with the TextBox values.

StudentsProvider provider = new StudentsProvider() Check for Duplicate values while inserting in GridView without SQL The following JavaScript function will be called when the Add Button is clicked. StudentDetails record = new StudentDetails(firstName, lastName, employer, phone, email, address, city, state, zip, dob, cardImagePath) Public static Int32 InsertStudent(Int32 studentId, String firstName, String lastName, String employer, String phone, String email, String address, String city, String state, String zip, String dob, String cardImagePath)
#INSERT USING OBJECTDATASOURCE WITH DUPLICACY CHECK CODE#
So is there any way I can tell the ObjectDataSource not to fire the method? See code simplified code below: I thought I could simply remove the InsertMethod attribute from the ObjectDataSource to eliminate the double fire on that method, but when I do that I get this error: But the Insert method fires twice! After thinking on this for a minute i realize this is the expected behavior - it's fired once when called from the ItemCommand event, and the second time from ObjectDataSource InsertMethod. In that event I call the insert method in the business layer - the same method specified in the ObjectDataSource control. So I wired up an ItemCommand event on the DetailsView - it picks up the event and I can do what i need with the FileUpload control just fine. Before going to my business layer I need access to a fileupload control. until i want to do something else before the insert method fires. I have the insert method written in a business layer (which calls down into a data layer) and everything works fine. I have an ObjectDataSource that I'm binding to a DetailsView control.
