I have problem inserting and updating Radgrid from code behind manually
In Inserting I cannot get the data from grid using ExtractValuesFromItem
In updating I get the old data not the updated data using ExtractValuesFromItem also
here's the source code
In Inserting I cannot get the data from grid using ExtractValuesFromItem
In updating I get the old data not the updated data using ExtractValuesFromItem also
here's the source code
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"grdMain"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"grdMain"
></
telerik:AjaxUpdatedControl
>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
telerik:RadGrid
ID
=
"grdMain"
runat
=
"server"
OnInsertCommand
=
"grdMain_InsertCommand"
OnUpdateCommand
=
"grdMain_UpdateCommand"
>
<
MasterTableView
EditMode
=
"InPlace"
CommandItemDisplay
=
"Top"
AutoGenerateColumns
=
"False"
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"Id"
DataType
=
"System.Int32"
HeaderText
=
"Id"
Visible
=
"true"
UniqueName
=
"Id"
ReadOnly
=
"true"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"MinValue"
DataType
=
"System.Int32"
FilterControlAltText
=
"Filter MinValue column"
HeaderText
=
"MinValue"
SortExpression
=
"MinValue"
UniqueName
=
"MinValue"
>
<
ColumnValidationSettings
EnableRequiredFieldValidation
=
"true"
RequiredFieldValidator-ControlToValidate
=
""
>
<
RequiredFieldValidator
ForeColor
=
"Red"
ErrorMessage
=
"*"
></
RequiredFieldValidator
>
</
ColumnValidationSettings
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"MaxValue"
DataType
=
"System.Int32"
FilterControlAltText
=
"Filter MaxValue column"
HeaderText
=
"MaxValue"
SortExpression
=
"MaxValue"
UniqueName
=
"MaxValue"
>
<
ColumnValidationSettings
EnableRequiredFieldValidation
=
"true"
>
<
RequiredFieldValidator
ForeColor
=
"Red"
ErrorMessage
=
"*"
></
RequiredFieldValidator
>
</
ColumnValidationSettings
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"ResultDate"
DataType
=
"System.DateTime"
FilterControlAltText
=
"Filter ResultDate column"
HeaderText
=
"ResultDate"
SortExpression
=
"ResultDate"
UniqueName
=
"ResultDate"
>
<
ColumnValidationSettings
EnableRequiredFieldValidation
=
"true"
>
<
RequiredFieldValidator
ForeColor
=
"Red"
ErrorMessage
=
"*"
></
RequiredFieldValidator
>
</
ColumnValidationSettings
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"ResultValue"
DataType
=
"System.Int32"
FilterControlAltText
=
"Filter ResultValue column"
HeaderText
=
"ResultValue"
SortExpression
=
"ResultValue"
UniqueName
=
"ResultValue"
>
<
ColumnValidationSettings
EnableRequiredFieldValidation
=
"true"
>
<
RequiredFieldValidator
ForeColor
=
"Red"
ErrorMessage
=
"*"
></
RequiredFieldValidator
>
</
ColumnValidationSettings
>
</
telerik:GridBoundColumn
>
<
telerik:GridEditCommandColumn
uniqueName
=
"EditCommandColumn"
></
telerik:GridEditCommandColumn
>
</
Columns
>
</
MasterTableView
>
</
telerik:RadGrid
>
protected void grdMain_InsertCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
{
AnalyzerResultBO _BO = new AnalyzerResultBO(); //Business object
GridEditableItem editedItem = e.Item as GridEditableItem;
Hashtable InputValues = new Hashtable();
//The GridTableView will fill the values from all editable columns in the hash
e.Item.OwnerTableView.ExtractValuesFromItem(InputValues, editedItem);
_BO.MaxValue = int.Parse(InputValues["MaxValue"].ToString());
_BO.MinValue = int.Parse(InputValues["MinValue"].ToString());
_BO.ResultValue = int.Parse(InputValues["ResultValue"].ToString());
_BO.ResultDate = InputValues["ResultDate"].ToString();
}
protected void grdMain_UpdateCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
{
AnalyzerResultBO _BO = new AnalyzerResultBO(); //Business Object
GridEditableItem editedItem = e.Item as GridEditableItem;
Hashtable InputValues = new Hashtable();
//The GridTableView will fill the values from all editable columns in the hash
e.Item.OwnerTableView.ExtractValuesFromItem(InputValues, editedItem);
_BO.MaxValue = int.Parse(InputValues["MaxValue"].ToString());
_BO.MinValue = int.Parse(InputValues["MinValue"].ToString());
_BO.ResultValue = int.Parse(InputValues["ResultValue"].ToString());
_BO.ResultDate = InputValues["ResultDate"].ToString();
}