Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Defauly focus in a WizardStep

Reply
Thread Tools

Defauly focus in a WizardStep

 
 
David Thielen
Guest
Posts: n/a
 
      02-27-2007
Hi;

How can I set the control to get the focus in a WizardStep? Everything I can
find shows how to do this for a form but in a wizard each step has a
different default control.

--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com

Cubicle Wars - http://www.windwardreports.com/film.htm


 
Reply With Quote
 
 
 
 
Steven Cheng[MSFT]
Guest
Posts: n/a
 
      02-28-2007
Hello Dave,

As for the focus in web page, the whole page wil only have a single focus.
So if you put wizard control on the page, those child controls in
wizardsteps also share this page focus. If you want to make a certain sub
control in your wizard control(in a certain wizardstep) get focus. You can
consider use Wizard control's Prerender event to get the control's
reference and then call Page.SetFocus against it. e.g.


==========aspx template==============
<asp:Wizard ID="Wizard1" runat="server" ActiveStepIndex="0" Height="135px"
Width="602px" OnPreRender="Wizard1_PreRender1">
<WizardSteps>
<asp:WizardStep runat="server" Title="Step 1">
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</asp:WizardStep>
<asp:WizardStep runat="server" Title="Step 2"
OnPreRender="Wizard1_PreRender">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" />
<asp:LinkButton ID="LinkButton1"
runat="server">LinkButton</asp:LinkButton>
<asp:ImageButton ID="ImageButton1" runat="server" />
<aspropDownList ID="DropDownList1" runat="server">
<asp:ListItem>aaa</asp:ListItem>
<asp:ListItem>bbb</asp:ListItem>
<asp:ListItem>ccc</asp:ListItem>
</aspropDownList>
</asp:WizardStep>
<asp:WizardStep runat="server" StepType="Finish"
Title="Step 3">
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
</asp:WizardStep>
</WizardSteps>
</asp:Wizard>

============code behind==========

protected void Wizard1_PreRender1(object sender, EventArgs e)
{
if (Wizard1.ActiveStepIndex == 1)
{
Control control =
Wizard1.WizardSteps[1].FindControl("DropDownList1");

Page.SetFocus(control);
}
}

==================

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

==================================================



This posting is provided "AS IS" with no warranties, and confers no rights.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing position of Wizardstep =?Utf-8?B?TWlrZQ==?= ASP .Net 3 09-03-2007 03:21 AM
this.window.focus() vs. window.focus() vs. this.focus() Roger Javascript 3 03-08-2007 08:53 PM
Wizard control: programmatically set visibility of (Templated)WizardStep Michel Couche ASP .Net 0 10-20-2006 09:41 AM
Strange problem setting focus on a TextBox within a WizardStep. =?Utf-8?B?Y2xpY2tvbg==?= ASP .Net 1 04-10-2006 02:11 PM
CreateUserWizard/WizardStep question.... tom.herz@gmail.com ASP .Net 0 02-09-2006 03:10 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57