Welcome to the Xceed Community | Help
Community Search  
More Search Options

How to edit a row in the datagrid?

Sort Posts: Previous Next
  •  06-23-2009, 2:57 PM Post no. 21945

    How to edit a row in the datagrid?

    Hello,

              I am using Xceed datagrid in my WPF app and I need to provider the user tthe ability to edit the data in the grid and then save it. I mean  the user just changes some data in the table and then clicks on a SAVE button which should change the data in the database. Also, I want to make some columns non-changeable. Can anyone please guide me with this? 

  •  06-23-2009, 4:14 PM Post no. 21949 in reply to 21945

    Re: How to edit a row in the datagrid?

     

     

    Hi Uday,

    Please consult the documentation on the page: http://doc.xceedsoft.com/products/XceedWpfDataGrid/Editing_Data.html to get you started on the edition process of the Xceed Datagrid for WPF.

    To prevent the edition you could set the ReadOnly property to True on the DataGridControl.

    For specific DataCells, you could set the same property using a Style.


    Xceed - Software Developer and Technical Support
  •  06-25-2009, 12:18 PM Post no. 22030 in reply to 21949

    Re: How to edit a row in the datagrid?

    Hi mohamed,

             Thanks for your reply. I tried what you have suggestedbut the link you refered says how to handle the events generated when we start editing the data in the cells. But what I need is little different. I have a save button and when the user clicks on it, I should commit the changes to the database. So, unless the user clicks the "Save" I should not commit any changes. Also there is a "Cancel" button by clicking which the user can discard all the changes. Can you please guide/help me with this issue? If you can send me an example that would be very helpful.

     

    Thanks,

    Uday
  •  06-25-2009, 12:42 PM Post no. 22032 in reply to 22030

    Re: How to edit a row in the datagrid?

    Hi Uday,

    The changes will not automatically be committed to the database when using the edit events, only the data source bound to the grid will be updated and the time of this update depends on the value of your UpdateSourceTrigger, a property on the Datagrid Control.

    To save the data in the database, you would have to handle the Click event on the button, establish a connection to your database and update it based on the information contained in the bound Data source. You could do that via Sql statements and SqlConnection/SqlAdapter if you are using a SQl server. For other type of servers, you would have to use the appropriate classes.


    Xceed - Software Developer and Technical Support
  •  06-25-2009, 1:15 PM Post no. 22037 in reply to 22032

    Re: How to edit a row in the datagrid?

    Thanks Mohamed. I will try what you suggested and get back to you if I ahve any issuesYes

View as RSS news feed in XML
Contact | Site Map | Reviews | Legal Terms of Use | Trademarks | Privacy Statement Copyright 2011 Xceed Software Inc.