StrataFrame Forum

Problem properly displaying data in 3rd party control using WebBusinessBindingSource

http://forum.strataframe.net/Topic11437.aspx

By Rob Toyias - 9/11/2007

I'm having difficulties trying to display data in a Telerik RadGrid that is bound via a WebBusinessBindingSource.  First I fill the bound BO with 3 records.  The RadGrid ends up displaying 3 items (or how ever many I've filled the BO with) but each line displays the data from the first record.  All the fields are displaying correctly, including the custom ones, except that it's the same data 3 times.

I've created a duplicate RadGrid that I connect directly to the BO, bypassing the WBBS and I get my 3 records and each line is displaying the correct data.  Except that here my custom fields are not displaying correctly.

Finally, just to take all the wind out of my sales when I use the default GridView bound via the WBBS it displays normally, different data on each line and the custom fields are displaying correctly...

How do I fix this?  

By StrataFrame Team - 9/13/2007

It might be the way that Telerik is enumerating over the business object when using the WBBS.  Since the default web grid is working properly, we'll need to get a copy of the Telerik controls and test is to see what is causing the issue.
By Rob Toyias - 9/13/2007

Thanks Ben!

Something else that isn't working when I bind via the WBBS is pagination.  When I enable pagination, set pagesize to 3 and fill my BO with 5 records,  I get the footer but I have 5 records displayed rather than the 3 I would expect.  If I bind the same RadGrid directly to the BO (rather than to the WBBS) I can paginate normally, but I get 'System.Data.DataRowView' where I should be seeing my custom fields.

I really appreciate your help on this!

By StrataFrame Team - 9/13/2007

When you are working with the pagination, are you binding to the RadGrid, or just to the basic DataGridView?
By Rob Toyias - 9/13/2007

Sorry I wasnt more clear. 

To simplify things and isolate the issue I created a new solution from scratch. I only added the one BO and the RadGrid to the page. I added a RadGrid and a GridView. I set both to allow paging and to have a pageSize of 3. Both are bound to my WBBS, which is wrapping my BO. I Fill my BO with the following 5 records.

1 - foo
2 - bar
3 - zip
4 - zap
5 - ack

The GridView displays the 3 records as expected, including the custom fields. and paginates normally to the 4th and 5th records.

The RadGrid on the other hand is displaying 3 records, but all three are displaying 'zip' and even stranger when I paginate forward the 2 records that are displayed both show as 'foo'. This happens regardless of the pagesize I set, it always displays the expected last record in place of all the displayed records. The only time this is not true is if I disable pagination and remove the pagesize, in that case it displays the first record ('foo') for all five entries.

I hope I'm making sense, thanks for your help!

By StrataFrame Team - 9/14/2007

OK, so the rad grid is displaying the correct number of records on pagination, just not the correct data for the records.  That makes sense.  I was thinking that it always displayed 5 records (with the same data) and didn't split it off into pages of 3 records. 

OK, that gives me some more info.  Thanks.

By Rob Toyias - 9/18/2007

Ben,

So have you had a chance to try to reproduce this?  I'm still trying to figure it out with no luch so far.

By Rob Toyias - 9/20/2007

Ben,

For lack of a better solution I am forced to use this hack for the time being.  I'm binding to the BO rather than the WBBS.  Do you have any idea why the WBBS is not advancing the CurrentRecord?

RadGrid1.ItemDataBound += new Telerik.WebControls.GridItemEventHandler(RadGrid1_ItemDataBound);

void RadGrid1_ItemDataBound(object sender, Telerik.WebControls.GridItemEventArgs e)
{
   GridItemType item = e.Item.ItemType;
   switch (item)
   {
      case GridItemType.AlternatingItem:
      case GridItemType.Item:
         MyBO.MoveNext();
      break;
   }
}

By Rob Toyias - 9/27/2007

I forgot to mention but in case anyone cares my above hack doesn't work if the grid is using paging.

Could probably wire it up to keep track of what row it should be displaying but I havn't had the time.

A real fix for the WBBS would be great.

By Rob Toyias - 10/15/2007

I created a test solution that demonstrates the issue.



You can see the WBBS version repeats the same row value.



I really appreciate your help on this.



Thanks!