Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Error - re-binding a GridView
Message
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
01309102
Message ID:
01311818
Views:
16
Kevin,

The error in RowDatabound is at the first line in the code after I check if it's a DataRow. The Row Index is zero and the EntityList.Count is 4. That's why I don't understand the RowNotInTable error.
    protected void gvLots_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        mmGridView gv = (mmGridView)sender;
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            int count = (int)(LotLineItems.EntityList[e.Row.RowIndex].LCount == null ? 0 : LotLineItems.EntityList[e.Row.RowIndex].LCount);
>Kevin,
>
>What happens is I have a lstRemainingLots_SelectedIndexChanged event where I call GetLotLineItems to repopulate the EntityList that the gvLots is bound to. As soon as I call the BO method that repopulates the EntityList, that's when the row_DataBound fires for the grid and I get the RowNotInTable error message.
>
>
>protected void lstRemainingLots_SelectedIndexChanged(object sender, EventArgs e)
>    {
>        GetLotLineItems();
>    }
>
>private void GetLotLineItems()
>{
>if (!this.chkShowInactive.Checked)
>{
>//When LotLineItems.EntityList is repopulated
>//gvLots_RowDataBound fires and RowNotInTable exception occurs
>            LotLineItems.EntityList = LotLineItems.GetLotsByLidActive(Convert.ToInt32(lstRemainingLots.SelectedValue));
>}
>else
>            LotLineItems.EntityList = LotLineItems.GetLotsByLid(Convert.ToInt32(lstRemainingLots.SelectedValue));
>
>        Session["dsLots"] = LotLineItems.DataSet;
>        this.BindControl(gvLots);
>}
>
>>E.R.,
>>
>>OK, and which specific line in this handler method is causing the error? The line number is displayed in the stack trace, but I don't know which line it is in the code you sent.
>>
>>Best Regards,
Regards,

E.R. Gilmore
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform