I have a grid that I am databinding to an in memory object. When i add a record I enter the new record details and press insert, the backend event seems to be getting fired but all the values of the columns are null.
<telerik:RadGrid ID="RadGrid1" GridLines="None" runat="server"
AllowAutomaticUpdates="True" AllowPaging="True"
AutoGenerateColumns="False" OnItemCommand="RadGrid1_ItemInsert" OnInsertCommand="RadGrid1_ItemInsert" OnItemUpdated="RadGrid1_Itemupdate" OnEditCommand="RadGrid1_ItemUpdated"
OnDeleteCommand="RadGrid1_ItemDeleted" OnItemInserted="RadGrid1_ItemInserted" OnDataBound="RadGrid1_DataBound" AutoGenerateEditColumn="True">
<MasterTableView CommandItemDisplay="Bottom" AllowAutomaticInserts="True" DataKeyNames="ID">
<Columns>
<telerik:GridBoundColumn DataField="ID" HeaderText="ID" SortExpression="ID"
UniqueName="ID">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Name" HeaderText="Name" SortExpression="Name"
UniqueName="Name">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="DisplayName" HeaderText="DisplayName" SortExpression="DisplayName"
UniqueName="DisplayName">
</telerik:GridBoundColumn>
<telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName= "DeleteColumn" />
</Columns>
</MasterTableView>
</telerik:RadGrid>
Code behind:
protected void RadGrid1_ItemInsert(object source, Telerik.Web.UI.GridCommandEventArgs e)
{
if (e.CommandName == RadGrid.InitInsertCommandName) //"Add new" button clicked
{
RadGrid1.DataSource = SessionHelper.XMLLayoutKey.layoutField;
RadGrid1.DataBind();
}
else if (e.CommandName == RadGrid.PerformInsertCommandName)
{
GridEditFormInsertItem editedItem = (GridEditFormInsertItem)e.Item;
string strCategoryName = editedItem["Name"].Text;
}
}
The column named "Name" is found yet it's value is always empty even though it has a value.
Any ideas?
<telerik:RadGrid ID="RadGrid1" GridLines="None" runat="server"
AllowAutomaticUpdates="True" AllowPaging="True"
AutoGenerateColumns="False" OnItemCommand="RadGrid1_ItemInsert" OnInsertCommand="RadGrid1_ItemInsert" OnItemUpdated="RadGrid1_Itemupdate" OnEditCommand="RadGrid1_ItemUpdated"
OnDeleteCommand="RadGrid1_ItemDeleted" OnItemInserted="RadGrid1_ItemInserted" OnDataBound="RadGrid1_DataBound" AutoGenerateEditColumn="True">
<MasterTableView CommandItemDisplay="Bottom" AllowAutomaticInserts="True" DataKeyNames="ID">
<Columns>
<telerik:GridBoundColumn DataField="ID" HeaderText="ID" SortExpression="ID"
UniqueName="ID">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="Name" HeaderText="Name" SortExpression="Name"
UniqueName="Name">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="DisplayName" HeaderText="DisplayName" SortExpression="DisplayName"
UniqueName="DisplayName">
</telerik:GridBoundColumn>
<telerik:GridButtonColumn CommandName="Delete" Text="Delete" UniqueName= "DeleteColumn" />
</Columns>
</MasterTableView>
</telerik:RadGrid>
Code behind:
protected void RadGrid1_ItemInsert(object source, Telerik.Web.UI.GridCommandEventArgs e)
{
if (e.CommandName == RadGrid.InitInsertCommandName) //"Add new" button clicked
{
RadGrid1.DataSource = SessionHelper.XMLLayoutKey.layoutField;
RadGrid1.DataBind();
}
else if (e.CommandName == RadGrid.PerformInsertCommandName)
{
GridEditFormInsertItem editedItem = (GridEditFormInsertItem)e.Item;
string strCategoryName = editedItem["Name"].Text;
}
}
The column named "Name" is found yet it's value is always empty even though it has a value.
Any ideas?