473,789 Members | 2,781 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Defaultbutton inside detailsview- best practise?

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
programmaticall y 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
Dec 5 '06 #1
1 2204
Not Me wrote:
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
programmaticall y 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 usesubmitbehavi or=false on the buttons I didn't
want to fire when return is pressed. seems ok so far..

cheers,
Chris
Dec 5 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
4073
by: chrisn | last post by:
Hi, (Using ASP.Net 2.0) I have a wizard control inside a detailsview control. When I attempt to call the InsertItem method on the DetailsView I get an error "ObjectDataSource 'ObjectDataSource1' has no values to insert. Check that the 'values' dictionary contains values." I have found I can suppress the error by placing a hidden field inside
0
1084
by: Evert Wiesenekker | last post by:
I have a mail page with a send button containing three validators (2 required val. and 1 expression val.). The masterpage contains 3 imagebuttons. Now when I press enter the first time the validators do their work. But when I press enter again one of the imagebuttons on the masterpage is fired. When I remove al validators everything works fine...
7
2813
by: Tim_Mac | last post by:
this is a re-post of an earlier message. i'm posting it under my MSDN alias for a better chance of reply :) when you press return in a multiline textbox, you expect to insert a newline. However, if you set the Form.DefaultButton property, whatever javascript code is employed by Asp.Net to handle this functionality intercepts the key press and submits the form, when using Firefox. This is a potentially serious problem and certainly a...
3
7450
by: John Mott | last post by:
Hi All, I'm trying to set the defaultbutton for a form to a button contained in a step template for a wizard control. This is the code in PreRender: switch (myWizard.ActiveStep.StepType) { case WizardStepType.Start: this.Page.Form.DefaultButton = "StartNextButton"; break; case WizardStepType.Finish: this.Page.Form.DefaultButton = "FinishButton"; break;
4
9758
by: Tim Mackey | last post by:
hi, asp.net 2. can anyone explain why this code does not work in firefox (2.0.0.1), but does work in IE 7. if you hit enter after typing something into the textbox, it should fire the Submit button click handler, instead it fires the event for the bogus button above it. btw it doesn't matter if i set it to ClientID, UniqueID or "btnSubmit" hard-coded, they all fail. <form id="form1" runat="server"> <asp:Button ID="Button1"...
1
3897
by: koraykazgan | last post by:
Hi all, I have a user control (ASCX). In that user control there is a panel, and inside that panel there is a textbox and a button. The panel has a DefaultButton property set, which is set to the button inside it. I also have a page, and on that page there are two instances of that user control (uc1 and uc2). I additionaly have an update panel on the page. In that update panel there is a label. This update panel has two async triggers...
1
7197
by: gsauns | last post by:
I have a DetailsView inside a ModalPopup (using the AJAX ModalPopupExtender). I would like the user to have the ability to change the DetailsView's mode within the ModalPopup. But whenever I click the button to change the mode, the ModalPopup closes itself. The NEXT time I open the ModalPopup, the mode has been changed. So the mode is changing... my problem is that I need the ModalPopup to stay visible. Also, the DetailsView is inside...
1
2186
by: ajrock2000 | last post by:
I am using a DetailsView to display some data. I am basically getting a firstname, and lastname fields from a database (the database cannot be changed, nor the queries), and I must concatenate the , . I want to incorporate this into a detailsview like so... <asp:TemplateField HeaderText="Name:"> <ItemTemplate> <%#Eval("firstname")%>, <%#Eval("lastname")%> </ItemTemplate> </asp:TemplateField> ...
3
1503
by: Steve Prescott | last post by:
Hi Gang, I am trying to set the DefaultButton prop of a Panel so that when the user has entered his login credentials and strikes the < Enter key, he will be loggin in. The Button (btnLogin) is buried under this hierarchy of parent controls: Panel asp.LoginView AnonymousTemplate asp.Login > LayoutTemplate btnLogin. I can't figure it out. Thanks for any ideas. Steve
0
2214
by: =?Utf-8?B?U2F2dm91bGlkaXMgSW9yZGFuaXM=?= | last post by:
In VS2008, I have a DetailsView control with a checkboxlist control inside its Edit template. (1) I want the checkboxlist to be dynamic and display only as many checkboxes as a user setting is configured. How? (2) Also the column that should depict the checkboxlist selections, is a simple character column in SSE2005, in the form of a comma-delimited string (e.g. 1,5,7,12,23). When the DetailsView is loaded, I want each of the...
0
9511
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10410
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10200
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10139
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9984
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5418
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3701
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.