Radgrid update

6 posts, 0 answers
  1. Arun
    Arun avatar
    13 posts
    Member since:
    May 2013

    Posted 17 Jun 2013 Link to this post

    Hi,
            I am using grid control in radcontrols. Please inform me about update values from gridview to database & how to get value of one textbox value using command name in code behind using c#.

    Thanks ,
    Arun.
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 17 Jun 2013 Link to this post

    Hi Arun.

    Please try the following code to get the new value.
    C#:
    protected void grid1_UpdateCommand(object sender, GridCommandEventArgs e)
     {
          GridEditableItem editItem = e.Item as GridEditableItem;
          Hashtable newValues = new Hashtable();
          TextBox txt = ((TextBox)editItem.FindControl("txt1"));
          string t = txt.Text; // to get the value by accessing control in edittemplate
          e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editItem);
          string id = newValues["EmployeeID"].ToString(); // to get the value by uniquename
     }

    Also take a look into the following help documentation.
    Updating Values Using InPlace and EditForms Modes

    Thanks,
    Shinu.
  3. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 17 Jun 2013 Link to this post

    Hi Arun.

    Please try the following code to get the new value.
    C#:
    protected void grid1_UpdateCommand(object sender, GridCommandEventArgs e)
     {
          GridEditableItem editItem = e.Item as GridEditableItem;
          Hashtable newValues = new Hashtable();
          TextBox txt = ((TextBox)editItem.FindControl("txt1"));
          string t = txt.Text; // to get the value by accessing control in edittemplate
          e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editItem);
          string id = newValues["EmployeeID"].ToString(); // to get the value by uniquename
     }

    Also take a look into the following help documentation.
    Updating Values Using InPlace and EditForms Modes

    Thanks,
    Shinu.
  4. Arun
    Arun avatar
    13 posts
    Member since:
    May 2013

    Posted 17 Jun 2013 Link to this post

    Hi shinu,
                 Thanks For your code for update.I have one more query regarding radgrid .When i trying to click edit button it shows  a  horizontal line .Instead of showing update & cancel link. I don't know how to solve .Please help me.

    Thanks ,
    Arun. 
  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 18 Jun 2013 Link to this post

    Hi,

    I was not able to replicate your issue. The best approach would be to use a GridEditCommandColumn rather than using a GridButtonColumn or a GridTemplateColumn. When the user presses the edit button for an EditCommandColumn and if the table view is configured for in-line editing, the Update and Cancel buttons automatically appear in place of the edit button. Check out the following help document to find out more on various columns in the grid.
    Column Types

    Thanks,
    Shinu.
  6. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 18 Jun 2013 Link to this post

    Hi,

    I was not able to replicate your issue. The best approach would be to use a GridEditCommandColumn rather than using a GridButtonColumn or a GridTemplateColumn. When the user presses the edit button for an EditCommandColumn and if the table view is configured for in-line editing, the Update and Cancel buttons automatically appear in place of the edit button. Please have a look into this help documentation.

    Hope this will hep you.
    Thanks,
    Shinu.
Back to Top