IntroductionI have been getting requests to write article on DataGrid CRUD operation without using any other control. So this article is for all the requestors. I have used only DataGrid for CRUD operation.Crating WPF Application ProjectFire up Visual Studio 2008 and Create a WPF Application and name the project as CRUDDataGridWPF.We would use Linq to SQL as our ORM. So add like below figure.Now after adding, open the Server Explorer and add the required table, in our case EMP_BASIC_INFO.We would change the table names as follows:Now in Blend I have designed the WPF Application like the below figure.The design displayed above contains a DataGrid for CRUD Operations and a TextBlock to display status messages.It's below the DataGrid.The following XAML code is for your reference:We will perform the operation in below order: Read Create and Update Delete Read OperationThe following code describes the read operation.Create and Update OperationThe following code describes the Create and Delete Operation.Delete OperationThe following code represents the Delete Operation.Now run the application and all the CRUD operations are successfully used.Note: Code is not written for multi select delete. It can be done the same way single select, try doing itHope this article helps.
Read OperationThe following code describes the read operation.Create and Update OperationThe following code describes the Create and Delete Operation.Delete OperationThe following code represents the Delete Operation.Now run the application and all the CRUD operations are successfully used.Note: Code is not written for multi select delete. It can be done the same way single select, try doing itHope this article helps.
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: