473,832 Members | 2,046 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Default Button

JJ
What trouble I'm having setting default buttons on a page (with a master
page).

I got around doing it on a page basis by calling the
SetWizardDefaul tButton() routine [see below] from page load. Notice how
messy it looks because I could not find the required button any other way
but by using the id it is given in the source code. I tried every
combination of nested 'findcontrol' methods I could think of, but none
worked??!! It seems to be impossible if the button generated on the fly, as
it seems to be in a wizard control. Is there a simpler and tidier way of
doing this?

My main issue here is how to do in from a custom control? If I am writing a
login control that will be in the corner of my master page, I want to "set
login button as default button if no other control on the page wants to do
the same". The problem is that the login button is again, generated on the
fly as its in a loginview control. This time using the source codes
generated id doesn't seem to work at all. What am I doing wrong??
Routine (that works even if it is untidy) that sets the default button. This
is called in the page load of a page derviced from the master page. But how
would I do the same for a control that is placed on either a page or the
master page itself?:
protected void SetWizardDefaul tButton()

{

Control theButton;

int StepIndex = CreateUserWizar d1.ActiveStepIn dex;

if (StepIndex == 0)

{

theButton =
this.FindContro l("ctl00$MainCo ntent$CreateUse rWizard1$__Cust omNav0$btn_Crea teUserButton");

}

else

{

theButton =
this.FindContro l("ctl00$MainCo ntent$CreateUse rWizard1$Comple teStepContainer $ContinueButton ");

}

Master.Page.For m.DefaultButton = theButton.Uniqu eID;

}
Oct 13 '06 #1
1 2176
JJ
also, how would you set a default button dynamically? i.e. if there are two
controls on a page with input fields and submit buttons, and a user clicks
in one of the input fields, how could you ensure that the deafult button was
that of the control they were currently using.

This functionality is really basic stuff, yet I can't find a solution that
works for wizards etc anywhere. There must be someone out there that knows a
solutions to this?

JJ
"JJ" <ab*@xyz.comwro te in message
news:%2******** ********@TK2MSF TNGP03.phx.gbl. ..
What trouble I'm having setting default buttons on a page (with a master
page).

I got around doing it on a page basis by calling the
SetWizardDefaul tButton() routine [see below] from page load. Notice how
messy it looks because I could not find the required button any other way
but by using the id it is given in the source code. I tried every
combination of nested 'findcontrol' methods I could think of, but none
worked??!! It seems to be impossible if the button generated on the fly,
as it seems to be in a wizard control. Is there a simpler and tidier way
of doing this?

My main issue here is how to do in from a custom control? If I am writing
a login control that will be in the corner of my master page, I want to
"set login button as default button if no other control on the page wants
to do the same". The problem is that the login button is again, generated
on the fly as its in a loginview control. This time using the source codes
generated id doesn't seem to work at all. What am I doing wrong??
Routine (that works even if it is untidy) that sets the default button.
This is called in the page load of a page derviced from the master page.
But how would I do the same for a control that is placed on either a page
or the master page itself?:
protected void SetWizardDefaul tButton()

{

Control theButton;

int StepIndex = CreateUserWizar d1.ActiveStepIn dex;

if (StepIndex == 0)

{

theButton =
this.FindContro l("ctl00$MainCo ntent$CreateUse rWizard1$__Cust omNav0$btn_Crea teUserButton");

}

else

{

theButton =
this.FindContro l("ctl00$MainCo ntent$CreateUse rWizard1$Comple teStepContainer $ContinueButton ");

}

Master.Page.For m.DefaultButton = theButton.Uniqu eID;

}


Oct 13 '06 #2

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

Similar topics

1
6398
by: Billy Jacobs | last post by:
Is there a way to make a button on a web form the default button so that when the user hits the enter button the code for that button executes? I have a web page Login.aspx where I have only 1 button on the form. When the user hits enter the button is clicked. I have a second page mycsepp.aspx which has an asp button and a link button. When I hit enter neither of the button click events are triggered. If I tab to one of them and
0
1872
by: Shixx | last post by:
Hello, I have problem in my web application and my web form. I have 5-6 buttons (web controls) and when I have focus on some text box, always one button becomes default and got focus, and after I write something in text box and press Enter I invoke that button method ?!?! But this is not button I want to be default. I set tab orders and nothing always that button becomes default when I am on some text box on web form. How can I set default...
3
6766
by: Marty McFly | last post by:
Hello, I have a control class that inherits from System.Web.UI.WebControls.Button. When I drag this control from the "My User Controls" tab in the toolbox onto the form, I want it to reflect the following default properties: Height = 32px, Width = 144px. I declare the Width property in my control as... \\\
5
5434
by: Wonder | last post by:
How can I create or use the msgobx to show a message without a default button. The user has explicity to click on the button, so the msgbox closes it. Thanks,
10
4826
by: cj | last post by:
Here's an easy one, I hope. How do I make button1, which I put on this form from the toolbox, the default button on the form? I thought it used to be a property in the properties window called default. It's not there now. I found in the help index an isdefault property and tried to set it in code but it doesn't show up in the list when I type button1.isdef
3
3591
by: Rick Brandt | last post by:
I am using some buttons to hide/show various divs and am changing the style of the button to indicate which button's view is "active". My problem is that for the non-active buttons I want the default look. Once I change a button's style to something else what is the style setting to revert them back to this default? EX: Button starts at default.
3
1573
by: Anil Kumar Sharma | last post by:
Hello, I am working on C# using vs.net 2003. I have faced two interesting problems. 1. Dynamically setting Default Button: I created a form and used it in various contexts. On basis of the context, the panel of a form which contains various buttons , are shown or hides. Now at design time i set the default button property to one of button. But when the form object is created in different context and set visibilty of default
15
12554
by: simonoficina | last post by:
Hello all! I am a vb.net beginner in Spain. When I use VB6 ,the button object has a property called "default" that can set this button like press "ENTER" key. But in the VB.net I can't find this property. Where is it? Or mabye change the other thing,No?Thanks ! Simon
4
2993
by: Whasigga | last post by:
Hi I've created a form that has 7 subforms. It is the same subform, bound to a table, just repeated. This form represents a week, and each subform is used to enter in data for each day of the week. The main form has a combo box that must have a value selected before anything else can happen. Once that value is selected, the 7 subforms are enabled, and also one of the fields is populated with the value from the main form. These subforms also...
0
10780
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
10498
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
10540
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
10212
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
9319
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6951
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
5789
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4421
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.