473,402 Members | 2,061 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,402 software developers and data experts.

Setting the Form DefaultButton to a wizard Step Button (2.0)

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;
default: this.Page.Form.DefaultButton = "StepNextButton"; break;
}

I get this error:
The DefaultButton of 'form1' must be the ID of a control of type
IButtonControl

The buttons are clearly just buttons defined in the Template section of the
wizard.
Why can't it see the buttons defined in the templates?

Thanks,

John Mott
jo********@hotmail.com
Nov 6 '06 #1
3 7425
Hi,

John Mott wrote:
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:
[...]
I get this error:
The DefaultButton of 'form1' must be the ID of a control of type
IButtonControl

The buttons are clearly just buttons defined in the Template section of the
wizard.
Why can't it see the buttons defined in the templates?
I've seen that issue with a login-control. The simple remedy was to create
a dummy-button (visible, but width and height = 0) whose .Click-event
called the appropriate button within the login-control. You should actually
put your wizard-control into a panel and register the dummy-button as the
default button for that panel, this way you can have default-buttons for
different areas of your form.

Cheers,
Olaf
--
My .02: www.Resources.IntuiDev.com
Nov 7 '06 #2
I had the same problems with the Wizard Control. After reading 9,000
blog posts I did this for the first button on the wizard.

Page.Form.DefaultButton =
Wizard1.FindControl("StartNavigationTemplateContai nerID$StartNextButton").UniqueID;

For the other pages you'll notice that the default behavior is to set
focus to the Previous button when you hit enter! Awesome built in
feature if you design your wizards to go backwards! To fix that I had
to set the values of UseSubmitBehavior.

<StepNavigationTemplate>
<asp:Button ID="StepPreviousButton"
UseSubmitBehavior="False" runat="server" CausesValidation="False"
CommandName="MovePrevious"
Text="Previous" />
<asp:Button ID="StepNextButton" UseSubmitBehavior="True"
runat="server" CommandName="MoveNext" Text="Next" />
</StepNavigationTemplate>

You've probably found a way to do this by now... but I figured I'd post
a solution anyways.

Now I'm having problems getting this to work with my Login Control
since I can't seem to figure out how to reference the submit button.

-Jennifer

Dec 18 '06 #3
Hi,

sh*****@gmail.com wrote:
Now I'm having problems getting this to work with my Login Control
since I can't seem to figure out how to reference the submit button.
haven't tried, but since ...
Page.Form.DefaultButton =
Wizard1.FindControl("StartNavigationTemplateContai nerID$StartNextButton").UniqueID;
.... did the trick for the wizard-control, shouldn't an analogous or similar
approach work for the login-control as well?
When I stumbled over that behaviour I also read tons of articles, blogs and
the such, without any hint leading to a work-around or "true" solution.
Hence the simple remedy that I posted. However, my solution sure seems
inappropriate in that it actually adds a superfluous control which someone
that reads the code will have to find out about. But time's expensive and
that approach is integrated quickly ... ;-)

And - thanks for posting your remedy. Keep us posted if you find one for
the login-control too!

Cheers,
Olaf
--
My .02: www.Resources.IntuiDev.com
Dec 19 '06 #4

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

Similar topics

2
by: dotnetjose | last post by:
Hi Folks, My subject message pretty musch explains it. By Default the Form definition sits at the Master Page file. Is there a way I can access the setting from my Content Page that uses a...
1
by: clickon | last post by:
For testing purposes i have got a 2 step WizardControl. Eqach step contains a text box, TextBox1 and TextBox2 respectively. If i put the following code in the respective activate event handlers...
1
by: clickon | last post by:
For testing purposes i have got a 2 step WizardControl. Eqach step contains a text box, TextBox1 and TextBox2 respectively. If i put the following code in the respective activate event handlers for...
12
by: raghav | last post by:
Hi I am working on ASP.NET 2.0. I am developing a website using Wizard control. Based on number of steps added, next, previous, finish buttons generate automatically. After running the...
3
by: Chinnala | last post by:
All, I have a "Search" button and "Cancel" button on a web page. When I hit enter, the "Cancel" button receives the focus and btnCancel event is fired. But I want the search button event to be...
4
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...
18
by: Axel Dahmen | last post by:
Hi, trying to submit an ASPX form using the key (using IE6) the page is not submitted in my web project. Trying to debug the pages' JavaScript code I noticed that there's some ASP.NET client...
9
by: Veerle | last post by:
Hi, When you use multiple asp:Buttons on one Form, then asp.net generates html submit buttons for all of them. When you put your cursor in one of the textfields of the form, the default submit...
8
by: GaryDean | last post by:
I have a Wizard page and need to affect the next and previous buttons from my code-behind. I've googled around and found two solutions, and neither appear to work. I can access the SideBarList...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.