that is my code
GridEditableItem editedItem = (GridEditableItem)e.Item;
string brand_ups = (editedItem["brand_ups"].Controls[0] as TextBox).Text; --> bring rad grid value not new value in textbox
string HBL_num = (editedItem["HBL_num"].Controls[0] as TextBox).Text; --> bring rad grid value not new value in textbox
string HBL_Status = (editedItem["HBL_Status"].Controls[0] as TextBox).Text; --> bring rad grid value not new value in textbox
int shipment_id = Convert.ToInt32(Shipid.SelectedValue);
try
{
SqlCommand updatehbl = new SqlCommand("*********", *********);
updatehbl.CommandType = CommandType.StoredProcedure;
connection.Open();
updatehbl.Parameters.Add("@shipment_ID", SqlDbType.Int).Value = shipment_id;
updatehbl.Parameters.Add("@brand_ups", SqlDbType.NVarChar, 20).Value = brand_ups;
updatehbl.Parameters.Add("@HBL_num", SqlDbType.NVarChar, 20).Value = HBL_num;
updatehbl.Parameters.Add("@HBL_Status", SqlDbType.NVarChar, 30).Value = HBL_Status;
updatehbl.ExecuteNonQuery();
connection.Close();
}
any advice will pleasure me
6 Answers, 1 is accepted

Try the following code snippet to access new value from the controls in Updatecommand event.
C#:
protected
void
radgrid1_UpdateCommand(
object
sender, GridCommandEventArgs e)
{
GridEditableItem editItem = e.Item
as
GridEditableItem;
Hashtable newValues =
new
Hashtable();
TextBox txt = ((TextBox)editItem.FindControl(
"textbox1"
));
string
value = txt.Text;
// to get the value of a textbox which is in EditItemTemplate
e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editItem);
string
id = newValues[
"EmployeeID"
].ToString();
// access by column uniquename
}
Thanks,
Princy.

that make grid load old values and after press update update template not disappear

Please use advancedatabinding method (needdatasource event) to assign/bind datasource to RadGrid. For more info. please check below code snippet.
http://demos.telerik.com/aspnet-ajax/grid/examples/programming/needdatasource/defaultcs.aspx
You are not able to get updated value because before you reach or execute the Update command, you are re-assigned datasource to your RadGrid.
Thanks,
Jayesh Goyani

everything work now successfully

Why I receive this error? "Specified argument was out of the range of valid values. Parameter name: index". Please refer to the PNG file.
my code:
Protected Sub RadGrid1_UpdateCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs)
Dim mydts As DateTime = DateTime.Now
Dim editedItem As GridEditableItem = TryCast(e.Item, GridEditableItem)
'Get the primary key value using the DataKeyValue.
'Dim EmployeeID As String = editedItem.OwnerTableView.DataKeyValues(editedItem.ItemIndex)("EmployeeID").ToString()
'Access the textbox from the edit form template and store the values in string variables.
'Dim LastName As String = (TryCast(editedItem("LastName").Controls(0), TextBox)).Text
'Dim FirstName As String = (TryCast(editedItem("FirstName").Controls(0), TextBox)).Text
'Dim Title As String = (TryCast(editedItem("Title").Controls(0), TextBox)).Text
'Dim Address As String = (TryCast(editedItem("Address").Controls(0), TextBox)).Text
'Dim City As String = (TryCast(editedItem("City").Controls(0), TextBox)).Text
'Dim LastName As String = (TryCast(editedItem("LastName").Controls(0), TextBox)).Text
Dim DIVISION As String = (TryCast(editedItem("DIVISION").Controls(0), TextBox)).Text
Dim DISTRICT As String = (TryCast(editedItem("DISTRICT").Controls(1), TextBox)).Text
Dim LOCATION As String = (TryCast(editedItem("LOCATION").Controls(2), TextBox)).Text
Dim FROM_YEAR As Integer = (TryCast(editedItem("FROM_YEAR").Controls(3), TextBox)).Text
Dim FROM_WEEK As Integer = (TryCast(editedItem("FROM_WEEK").Controls(4), TextBox)).Text
Dim TO_YEAR As Integer = (TryCast(editedItem("TO_YEAR").Controls(5), TextBox)).Text
Dim TO_WEEK As Integer = (TryCast(editedItem("TO_WEEK").Controls(6), TextBox)).Text
'Dim USERID As String = (TryCast(editedItem("USERID").Controls(0), TextBox)).Text
Dim USERID As String = Session("currUserID")
'Dim USERNAME As String = (TryCast(editedItem("USERNAME").Controls(0), TextBox)).Text
Dim USERNAME As String = Session("currUserName")
Try
Dim strConnect As New OracleConnection()
Dim strEnvironment As String = Session.Item("Environment")
Dim m_strFASConnectionString As New OracleConnection()
Dim objMiscHelperFunctions As New MiscHelperFunctions(strEnvironment)
Dim m_oraFASConn As OracleConnection
m_strFASConnectionString.ConnectionString = objMiscHelperFunctions.GetFASConnectionString()
OracleConnection = New OracleConnection(m_strFASConnectionString.ConnectionString)
'Open the SqlConnection
OracleConnection.Open()
'Update Query to update the Datatable
Dim updateQuery As String = "UPDATE WFM_CAT_RECURRENCE_DT set DIVISION='" & DIVISION & "',DISTRICT='" & DISTRICT & "',LOCATION='" & LOCATION & "',FROM_YEAR='" & FROM_YEAR & "',FROM_WEEK='" & new_From_Week & "',TO_YEAR='" & TO_YEAR & "',TO_WEEK='" & new_To_Week & "',USERID='" & USERID & "',USERNAME='" & USERNAME & "',CREATE_DATE=sysdate WHERE DIVISION= " & DIVISION & " AND DISTRICT = " & DISTRICT & " AND LOCATION = " & LOCATION & " AND FROM_YEAR = " & FROM_YEAR & " AND FROM_WEEK = " & old_From_Week & " AND TO_YEAR = " & TO_YEAR & " AND TO_WEEK = " & old_To_Week & ""
OracleCommand.CommandText = updateQuery
OracleCommand.Connection = OracleConnection
OracleCommand.ExecuteNonQuery()
'Close the SqlConnection
OracleConnection.Close()
Catch ex As Exception
RadGrid1.Controls.Add(New LiteralControl("Unable to update record. Reason: " + ex.Message))
e.Canceled = True
End Try
End Sub

Please provide your aspx page code/grid markup.
Thanks,
Jayesh Goyani