I create string variable "onEditUser" to be filled with a cell value (Label) when "Edit" command is fired. It is assigned correctly when The Edit button is clicked but when OnItemCommand() is recalled to perform Update Command, the variable assignment is removed and onEditUser become null.
Is there any help why this occurs, and what is the solution? (I need to use this variable in another method)
public partial class EditUsers : System.Web.UI.Page{string onEditUser; public void GridItemCommand(object sender, GridCommandEventArgs e) { if (e.CommandName == RadGrid.UpdateCommandName || e.CommandName == RadGrid.PerformInsertCommandName) { GridEditableItem item = e.Item as GridEditableItem; RadComboBox userTypecombo = (RadComboBox)item.FindControl("UserTypeRadComboBox"); string userType = userTypecombo.SelectedItem.Text; SqlDataSource1.InsertParameters["UserType"].DefaultValue = userType; SqlDataSource1.UpdateParameters["UserType"].DefaultValue = userType; } if (e.CommandName == RadGrid.EditCommandName) { GridItem item = e.Item; Label userNameLB = (Label)item.FindControl("UserNameLabel"); onEditUser = userNameLB.Text; } }