I'm experiencing a problem where my code calls the rebind method, and this throws an exception for a reason I cannot figure out.
The exception it throws is: " System.Data.DataRowView' does not contain a property with the name 'post_flag' " It throws this error even when it does not delete the cell and simply rebinds it.
Here are the attributes of the grid:
<telerik:RadGrid ID="_ExpGrid" runat="server" AllowPaging="True" PageSize="15" AutoGenerateColumns="false"
Width="1700px" CellSpacing="4" Skin="Web20" OnItemCreated="_ExpGrid_ItemCreated" AllowSorting="true"
OnDeleteCommand="_ExpGrid_DeletedCommand" OnPageIndexChanged="_ExpGrid_SelectedIndexChanged">
Here is the delete method:
if (IsPostBack)
{
Service.ServiceClient client = new Service.ServiceClient(ConfigurationManager.AppSettings["ServiceBinding"]);
GridDataItem dataItem = (GridDataItem)e.Item;
int id = Convert.ToInt32(dataItem.GetDataKeyValue("Expense_ID"));
client.DeleteTrans(id);
_ExpGrid.Rebind();
}
This is the line that throws an exception:
<asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Convert.ToBoolean(Eval("POST_FLAG")) %>' Enabled="false" />
The exception it throws is: " System.Data.DataRowView' does not contain a property with the name 'post_flag' " It throws this error even when it does not delete the cell and simply rebinds it.
Here are the attributes of the grid:
<telerik:RadGrid ID="_ExpGrid" runat="server" AllowPaging="True" PageSize="15" AutoGenerateColumns="false"
Width="1700px" CellSpacing="4" Skin="Web20" OnItemCreated="_ExpGrid_ItemCreated" AllowSorting="true"
OnDeleteCommand="_ExpGrid_DeletedCommand" OnPageIndexChanged="_ExpGrid_SelectedIndexChanged">
Here is the delete method:
if (IsPostBack)
{
Service.ServiceClient client = new Service.ServiceClient(ConfigurationManager.AppSettings["ServiceBinding"]);
GridDataItem dataItem = (GridDataItem)e.Item;
int id = Convert.ToInt32(dataItem.GetDataKeyValue("Expense_ID"));
client.DeleteTrans(id);
_ExpGrid.Rebind();
}
This is the line that throws an exception:
<asp:CheckBox ID="CheckBox1" runat="server" Checked='<%# Convert.ToBoolean(Eval("POST_FLAG")) %>' Enabled="false" />