DataRepeater: ItemValueNeeded event doesn't fire, resizing items not working

0
0

Migrating a large project from Wisej 1.5 to 2.5.

In 1.5 version I used the Slidebar using .Controls.Add to add as many items (each a custom control) as required and then using the scroll event to identify items as they scroll into view and require data.

In 2.5 I’m moving from Slidebar to DataRepeater and it’s obviously significantly faster. (Thanks !!)

However looking for asisstance with a number of issues not yet resolved, hoping you can assist:

1) In the DataRepeater test project which uses a Label & TextBox in the ItemTemplate.Controls and with DataRepeater.VirtualMode = True, the DataRepeater.ItemValueNeeded event fires as expected for the Label & TextBox. However instead of the Label & TextBox I’m using a custom control which Inherits Wisej.Web.UserControl then the ItemValueNeeded event does not fire for that control; but changing the control from Inherits Wisej.Web to Inherits Wisej.Web.TextBox then the ItemValueNeeded event does fire. I suspect the DataRepeaterItemValueEventHandler needs to be implemented for the custom control but I haven’t been able to implement it.

2) The Resize event of the parent control Resizes the DataRepeater control and in doing so needs to Resize each of the custom control items; we know how many items there are from DataRepeater1.ItemCount, but I can’t see how to iterate through the custom controls to Resize each instance of same.

3) When a custom control is Resized it determines its own height (all instances will be the same height); then the parent control can get the height of the custom control and set the size of the DataRepeater items to that height; I’ve tried setting the DataRepeater.ItemTemplate.Height and the DataRepeater.ItemSize but with variable results, scrolling the DataRepeater up & down shows some of the custom controls with the required height, others are unchanged.

TIA,
Roger

  • You must to post comments
0
0

Hi Frank,

Have made good progress on the issues.

Now have the project working perfectly with DataRepeater using the workarounds below.

1) NOT RESOLVED – if the custom control added to ItemTemplate.Controls Inherits Wisej.Web.UserControl then the ItemValueNeeded event does not fire for that control; but changing the control from Inherits Wisej.Web to Inherits Wisej.Web.TextBox then the ItemValueNeeded event does fire.

2) & 3) RESOLVED: in the parent control Resize event, the custom controls can be idenified & resized by:
a) iterate the controls in the DataRepeater1.Controls,
b) for each control which has TypeOf DataRepeaterItem, iterate the controls in that DataRepeaterItem,
c) for each of those controls which has TypeOf the custom control, resize that item & get back its height,
d) set the height of the DataRepeaterItem according to that height

4) NEW: I can’t identify a DataRepeater event which can be used when the DataRepeater.DataSource is set that can be used to Resize as above. As a workaround I’m using the DataRepeater.ItemValueNeeded event to identify & resize the custom control (as above) as well as feeding it data. The DataRepeater.ItemsAdded event never fires otherwise I had thought to use that to Resize. This workaround works perfectly – you never see an Item which hasn’t been fed data or not resized. Can you suggest an event which could be used?

See test project (based on the DataRepeaterDragDrop example) attached with the above implemented:
> The custom control ctlTest contains a button & textbox and resizes it’s height via Sub m_Resize.
> in ctlTest.designer.vb, changing Inherits Wisej.Web.TextBox to Inherits Wisej.Web.UserControl will cause DataRepeater1.ItemValueNeeded in Page1.vb not to fire on ctlTest and the yellow controls don’t get populated with “HELLO-x” text

Cheers,
Roger

  • You must to post comments
0
0

Hi Roger,

thanks for reporting these issues. We´ll try to reproduce on our end and get back to you.

Best regards
Frank

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.