How do I update a cell value

5 posts, 0 answers
  1. SarperSozen
    SarperSozen avatar
    10 posts
    Member since:
    Nov 2015

    Posted 01 Feb 2017 Link to this post

    I am using RadGridView. I insert datas to RadGirdView like this:

    // I am using Lambda Expression to get datas from Database.
    var o = _vt.persons;
    radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
    radGridView1.Columns.Clear();
    radGridView1.Rows.Clear();
    radGridView1.MasterTemplate.AllowAddNewRow = false;
    radGridView1.Columns.Add(new GridViewDecimalColumn("No"));
    radGridView1.Columns.Add(new GridViewTextBoxColumn("Puanı"));
    radGridView1.Columns.Add(new GridViewTextBoxColumn("Sonuç"));
    radGridView1.Columns[0].Width = 8;
    radGridView1.Columns[0].ReadOnly = true;
    {
        var enumerable = o.ToArray();
        foreach (var m in enumerable)
        {
            var r = radGridView1.Rows.AddNew();
            r.Cells[0].Value = m.no;
            r.Cells[0].Tag = "no";
     
            r.Cells[1].Value = m.puani;
            r.Cells[1].Tag = "puani";
     
            r.Cells[2].Value = m.sonuc;
            r.Cells[2].Tag = "sonuc";
        }
    }
    radGridView1.ClearSelection();
    radGridView1.CurrentRow = null;

    You knoew, when double-click on a cell, it forms to editable mode. You enter a new value an when you click anywhere on the form or click enter, new value appears in the cell. But when I lick anywhere on the form or click enter, I want to save new value to the database. For this, I am using CellEndEdit event, but I did not manage to save new value to database.

     

    Kind regards,

    Mehmet.

     

  2. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    4081 posts

    Posted 01 Feb 2017 Link to this post

    Hello Mehmet,

    Thank you for writing.  

    It is appropriate to handle the CellValueChanged event which is fired immediately after the user edits a single cell. I would recommend you to have a look at the following help article which demonstrates how to update the database: http://docs.telerik.com/devtools/winforms/gridview/populating-with-data/updating-the-database-with-ado.net

    I hope this information helps. Should you have further questions I would be glad to help.

    Regards,
    Dess
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  3. SarperSozen
    SarperSozen avatar
    10 posts
    Member since:
    Nov 2015

    Posted 01 Feb 2017 in reply to Dess | Tech Support Engineer, Sr. Link to this post

    Dess, firstly thnak you very much. RadGridView is filled datas from database while Form loading. And CellValueChanged event is fired while loading datas on Form loading too. For eample if we have 36 pieces of data, CellValuChanged is fired 36 times. So I decided to use CellEndEdit. Is there any solution about tihs situation?

    For updating, I will try soon.

    Kind regards,

    Mehmet.

  4. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    4081 posts

    Posted 02 Feb 2017 Link to this post

    Hello Mehmet,

    Thank you for writing.  

    If you add the rows in RadGridView programmatically in unbound mode, I would recommend you to subscribe to the CellValueChanged event after the grid is populated with data. Thus, the event will be fired when you really update the cell's value and update the database accordingly.

    I hope this information helps. Should you have further questions I would be glad to help.

    Regards,
    Dess
    Telerik by Progress
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
  5. SarperSozen
    SarperSozen avatar
    10 posts
    Member since:
    Nov 2015

    Posted 12 Feb 2017 in reply to Dess | Tech Support Engineer, Sr. Link to this post

    I took a break because I had to work for a PhD qualification exam. I hope to try again later and write down the result here.

    So glad I have you

    Mehmet.

Back to Top