This is a migrated thread and some comments may be shown as answers.

Radgrid update

5 Answers 73 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Arun
Top achievements
Rank 1
Arun asked on 17 Jun 2013, 07:27 AM
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.

5 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 17 Jun 2013, 08:38 AM
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.
0
Shinu
Top achievements
Rank 2
answered on 17 Jun 2013, 08:43 AM
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.
0
Arun
Top achievements
Rank 1
answered on 17 Jun 2013, 11:44 AM
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. 
0
Shinu
Top achievements
Rank 2
answered on 18 Jun 2013, 05:08 AM
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.
0
Shinu
Top achievements
Rank 2
answered on 18 Jun 2013, 05:17 AM
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.
Tags
General Discussions
Asked by
Arun
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Arun
Top achievements
Rank 1
Share this question
or