Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Datarepeater in Virtualmode with button

Status
Not open for further replies.

huggyboy

Programmer
Feb 7, 2003
108
GB

I am populating a datarepeater in virtualmode and in the middle of each repeater line i have put a button

It is all displayed as you would expect - with the code i have written in the ItemValueNeeded event populating the data and the click event is fired when the button is clicked - all ok so far.

On some lines i want the button unenabled and would have to set this when each of the repeater lines scroll into view in the repeater so need to set it when the ItemValueNeeded event is fired.

However when i monitored (in debug mode) the ItemValueNeeded event, it is fired for each of the fields in turn except the button!

Any thoughts?
 
Tried a work around of controlling the button in the datarepeater DrawItem event putting in the lines

e.DataRepeaterItem.Controls.Item("btnCopyOne").Text = "Changed!"
e.DataRepeaterItem.Controls.Item("btnCopyOne").Enabled = False

which had bizarre outcomes - the text appeared on every button ok but after the form load the datarepeater was left on the last 'screen' of data with the button enabled but scrolling up the other screens the button was unenabled and scrolling back down the button had unenabled itself!

Putting in the line visible=false instead of enabled=false worked exactly as one would expect - no buttons displayed on any line

The investigation continues ... on the face of it i seem to be using datarepeaters in an unusual fashion - no joy on google or msdn
 
The easy work around for my first issue is to use a hyperlink instead of a button for which an itemneeded event IS fired so can enable or unenable as required (check boxes work as well).

Havent solved the screen update of the unenabled fields problem (text boxes react in same way as the button text) - working on trying to set the datarepeater screen to the top of the data.
 
Follow-up - totally abandoned this idea and recoded the display using tabcontrols & pages with 'variablen' type names (n is line number) and populated & made visible when needed - not very elegant but used on another screen in the project so i know will work - would have been easier with VB6 control arrays but there we are
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top