Linqdatasource onupdating event
I don't use Query String with Data Pager and assign Page Size of Data Pager in the first time of page load to prevent the List View bind again (as in some instructions I found in forum) I can't post my code because it's quite large.In this small walk through I will demonstrate how to use linq datasource to do insert,update,delete and select using form view,gridview and details view control.The Details View displays a single record based on the Linq Data Source which retrieves a single customer selected on the gridview control.The where parameter for the linq datasource gets its value from the customer grid's Selected Value property.In order to Insert Customer using North Wind Data Context, I make use of Formview and linq datasource control. If you have been using the Formview control earlier, the code would look very similar.I am setting the Data Source ID to linq datasource which makes it possible to insert customer into the database.I also have a button whose command Name property is set to Insert to trigger the Insert process.It is important that you set the Data Key Names property to the primarykey column in the customer entity which is Customer ID.
NET 3.5 sp1) to implement search feature with paging. But In the first time, the Selecting event of Linq Data Source fire twice and I don't know why (I debugged my code very carefully).
Since I want the my customer grid to be sorted by Contact Name I am setting the Order By clause to Contact Name.
I also want my customer grid to be sortable and pagable and for that I set the my datasource to Auto Sort and Auto Page.
Handling the Deleted Event In addition to pre-processing events such as the delete operation completes, so you could use this event to check whether the deletion was successful and/or perform cleanup activities.
Again, the control receives data about the deleted object in a special argument type, the Linq Data Source Status Event Args object.
In order for my grid to support updating,deleting and selecting, I set my Auto Generate Select Button, Auto Generate Edit Button and Auto Generate Delete Button to true.