I have a telerik RadGrid. I have applied Manual CRUD operations in it. I am using In-Place editing mode. The problem is, when I am trying to Insert or Update the records, i am getting null values by this method
e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem);
Same thing happening in both RadGrid_UpdateCommand and RadGrid_InsertCommand.
Following is my ASPX code
<
telerik:RadScriptManager
runat
=
"server"
ID
=
"RadScriptManager1"
/>
<
telerik:RadSkinManager
ID
=
"RadSkinManager1"
runat
=
"server"
ShowChooser
=
"true"
/>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"rGrid"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"rGrid"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
telerik:RadAjaxLoadingPanel
runat
=
"server"
ID
=
"RadAjaxLoadingPanel1"
/>
<
telerik:RadFormDecorator
ID
=
"RadFormDecorator1"
runat
=
"server"
DecorationZoneID
=
"demo"
EnableRoundedCorners
=
"false"
DecoratedControls
=
"All"
/>
<
telerik:RadGrid
ID
=
"rGrid"
runat
=
"server"
AllowPaging
=
"True"
PageSize
=
"10"
AllowSorting
=
"True"
AutoGenerateColumns
=
"false"
AllowFilteringByColumn
=
"True"
CellSpacing
=
"0"
GridLines
=
"None"
OnNeedDataSource
=
"rGrid_NeedDataSource"
OnItemCreated
=
"rGrid_ItemCreated"
OnPreRender
=
"rGrid_PreRender"
OnInsertCommand
=
"rGrid_InsertCommand"
OnUpdateCommand
=
"rGrid_UpdateCommand"
ondeletecommand
=
"rGrid_DeleteCommand"
>
<
PagerStyle
Mode
=
"NextPrevAndNumeric"
/>
<
GroupingSettings
CaseSensitive
=
"false"
/>
<
MasterTableView
DataKeyNames
=
"ID"
EditMode
=
"InPlace"
CommandItemDisplay
=
"Top"
InsertItemPageIndexAction
=
"ShowItemOnCurrentPage"
>
<
Columns
>
<
telerik:GridEditCommandColumn
ButtonType
=
"ImageButton"
UniqueName
=
"EditCommandColumn"
HeaderText
=
"Edit"
>
</
telerik:GridEditCommandColumn
>
<
telerik:GridBoundColumn
DataField
=
"ID"
UniqueName
=
"ID"
HeaderText
=
"ID"
ColumnEditorID
=
"GridTextBoxEditor1"
ReadOnly
=
"true"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Name"
UniqueName
=
"Name"
HeaderText
=
"Name"
ColumnEditorID
=
"GridTextBoxEditor1"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"ContactPerson"
UniqueName
=
"ContactPerson"
HeaderText
=
"Contact Person"
ColumnEditorID
=
"GridTextBoxEditor2"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Address"
UniqueName
=
"Address"
HeaderText
=
"Address"
ColumnEditorID
=
"GridTextBoxEditor3"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Country"
UniqueName
=
"Country"
HeaderText
=
"Country"
ColumnEditorID
=
"GridTextBoxEditor4"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"City"
UniqueName
=
"City"
HeaderText
=
"City"
ColumnEditorID
=
"GridTextBoxEditor5"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Phone"
UniqueName
=
"Phone"
HeaderText
=
"Phone"
ColumnEditorID
=
"GridTextBoxEditor6"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Email"
UniqueName
=
"Email"
HeaderText
=
"Email"
ColumnEditorID
=
"GridTextBoxEditor7"
>
</
telerik:GridBoundColumn
>
<
telerik:GridClientDeleteColumn
HeaderText
=
"Delete"
ButtonType
=
"ImageButton"
>
<%--<
telerik:GridButtonColumn
ConfirmText
=
"Delete this product?"
ConfirmDialogType
=
"RadWindow"
ConfirmTitle
=
"Delete"
ButtonType
=
"ImageButton"
CommandName
=
"Delete"
/>--%>
<
HeaderStyle
Width
=
"70px"
/>
</
telerik:GridClientDeleteColumn
>
</
Columns
>
<
EditFormSettings
>
<
EditColumn
ButtonType
=
"ImageButton"
/>
</
EditFormSettings
>
</
MasterTableView
>
<
ClientSettings
>
<
ClientEvents
OnUserAction
=
"UserAction"
/>
</
ClientSettings
>
</
telerik:RadGrid
>
Following is Code behind
public
partial
class
Suppliers : System.Web.UI.Page
{
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(!IsPostBack)
{
}
}
protected
void
rGrid_NeedDataSource(
object
sender, GridNeedDataSourceEventArgs e)
{
Code.BLL.Suppliers objSuppliers =
new
Code.BLL.Suppliers();
List<Code.BLL.Suppliers> lstSupplier = objSuppliers.Load();
rGrid.DataSource = lstSupplier;
}
protected
void
rGrid_ItemCreated(
object
sender, Telerik.Web.UI.GridItemEventArgs e)
{
}
protected
void
rGrid_PreRender(
object
sender, EventArgs e)
{
}
protected
void
rGrid_InsertCommand(
object
sender, GridCommandEventArgs e)
{
GridEditableItem editedItem = e.Item
as
GridEditableItem;
Hashtable newValues =
new
Hashtable();
e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem);
//editedItem.ExtractValues(newValues); I have tried both methods, but got null values from both
}
protected
void
rGrid_UpdateCommand(
object
sender, GridCommandEventArgs e)
{
GridEditableItem editedItem = e.Item
as
GridEditableItem;
//Prepare new dictionary object
Hashtable newValues =
new
Hashtable();
e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem);
editedItem.ExtractValues(newValues);I have tried both methods, but got
null
values from both
}
protected
void
rGrid_DeleteCommand(
object
sender, GridCommandEventArgs e)
{
}
}