Defaultbutton inside detailsview- best practise?

N

Not Me

Hi,

I've been trying different ways of getting an insert button within a
detailsview control to be the default button when the return key is pressed.

Using a panel and itemtemplates I get the exception "{"The DefaultButton
of '' must be the ID of a control of type IButtonControl."} - why it
thinks I'm referencing ''? Is it a scope issue because the button is
within the itemtemplate?

an alternative was just sticking with a commandbutton, and
programmatically assigning the forms' default button (via the
masterpage). However this relied on reading the source, getting the
client name (e.g. ctl108) and including that in the code.. surely not an
ideal solution (not sure how arbitrary the control name is, but it's
changed a few times in my testing)

Is there a 'proper' solution I've overlooked?
any tips?

cheers,
Chris
 
N

Not Me

Not said:
I've been trying different ways of getting an insert button within a
detailsview control to be the default button when the return key is
pressed.

Using a panel and itemtemplates I get the exception "{"The DefaultButton
of '' must be the ID of a control of type IButtonControl."} - why it
thinks I'm referencing ''? Is it a scope issue because the button is
within the itemtemplate?

an alternative was just sticking with a commandbutton, and
programmatically assigning the forms' default button (via the
masterpage). However this relied on reading the source, getting the
client name (e.g. ctl108) and including that in the code.. surely not an
ideal solution (not sure how arbitrary the control name is, but it's
changed a few times in my testing)

For google groups, if noone else ;)

managed a 'fix' by using usesubmitbehavior=false on the buttons I didn't
want to fire when return is pressed. seems ok so far..

cheers,
Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top