This is a migrated thread and some comments may be shown as answers.

Problem with rebind method

1 Answer 91 Views
Grid
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 27 Jan 2014, 07:10 PM
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" />

      






1 Answer, 1 is accepted

Sort by
0
John
Top achievements
Rank 1
answered on 27 Jan 2014, 08:10 PM
I managed to solve this on my own by adding a datasource into the delete method.
Tags
Grid
Asked by
John
Top achievements
Rank 1
Answers by
John
Top achievements
Rank 1
Share this question
or