|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Making ASP.NET 2.0 asp:Wizard control fully Navigatable without moIs there a good way to have the asp:wizard navigation control default to the next button instead of the previous button? I need my wizard to be navigatable without a mouse. I have set the tab index but unfortunetly the previous button will still appear highlighted and accept an ENTER key. I don’t know what is causing this...The highlight appears as a solid black border..different than the focus that has a dotted border. It seems to happen after the content portion of the wizard/templateWizard step has been touched. I have tried using javascript to forward the focus from the Previous button to the Next button. This is visible to the user and can effect how other controls work. (If you have a radio button list and make it forward focus to the NextButton after it’s been selected the user can no longer use the keyboard to adjust their selection in the radiobuttonlist.) *Accessing Buttons Programmatically: Can you only access navigation buttons in a TemplatedWizardStep? The only way I have been able to access a navigational button programmatically is with : myTemplatedWizardStep.CustomNavigationTemplateContainer.FindControl("StepNextButton") The custom NavigationTemplateContainer only exists for Templated steps not wizard steps. I am surprised it isn’t possible to access buttons in navigation section of a wizardStep. I have tried accessing navigation buttons in a wizardStep with and without a StepNavigationTemplate. (Via customizing as wizardStep navigation template.) *Visible AccessKeys in a wizard step: To this same end the navigation buttons have to support Access Keys. I tried using an html button so that the hot keys are visible to the user. (asp:button does not accept markup so I am unable to under line the hotkey) Unfortunetly the html button doesn’t have a commandName property. I don’t believe this is directly compatible with the recommended NextButtonClick event handler Protected Sub OnNext(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.WizardNavigationEventArgs) Handles Wizard1.NextButtonClick Select Case e.NextStepIndex Case 0 Case 1 ‘Prep things for wizardStepIndex 1 display. Case 2 End sub I tried to shoehorn my new html button into the recommend flow control Like this: Sub myHtmlNextButton_OnClick(ByVal sender As Object, ByVal e As EventArgs) Dim WizEvent As New System.Web.UI.WebControls.WizardNavigationEventArgs(Me.Wizard1.ActiveStepIndex(), Me.Wizard1.ActiveStepIndex() + 1) OnNext(Wizard1, WizEvent) ‘ The below code had to added otherwise the page would not change (Yes; the page was valid and the e.cancel=false) If (Me.Page.IsValid And WizEvent.Cancel = False) Then Wizard1.MoveTo(Wizard1.WizardSteps(WizEvent.NextStepIndex)) Else End If End Sub I had to use the Wizard.MoveTo method to increment the page. This isn’t good because my wizard has some non-linear navigation. (Some selection make wizard steps not applicable) Sometimes the NextStep handler will need to forward the user to a different step using Wizard.MoveTo. With the myHtmlNextButton_OnClick as it is now this would undo the desired navigation. All I wanted to do was make HotKeys visible to the user. Is there a better way to do this or a better way to integrate the use of htmlButtons with the wizard control? In summary: • What is the best way to make the wizard control default to the Next button (Its normal behavior is default to the previous step)? • Is it possible to access navigation buttons in code without having to use TemplatedWizardSteps? • What is the best way to make the Access keys on a wizard navigation button visible to the user and not give up the convienence of the wizard.NextButtonClick of the wizard control? I have read every article I can find on this and none of them address these questions. Any examples, guidance, or thoughts would be greatly appreciated! Thanks, Jeff Hi Jeff,
Thanks for posting! For the current issues, I have performed some tests. >"What is the best way to make the wizard control default to the Next button (Its normal behavior is default to the previous step)?"I have a workaround for this but only working with the ContentTemplate control. We can define the DefaultButton for the current wizard control likes below: <asp:TemplatedWizardStep ID="TemplatedWizardStep1" Title="Step 1" runat="server" StepType="Step"> <ContentTemplate> <asp:Panel ID="mypanel" runat="server" DefaultButton="Button1"> <asp:TextBox ID="mytextbox" runat="server" /> <asp:Button ID="Button1" runat="Server" Text="My Button" CommandName="MoveNext"/> </asp:Panel> </ContentTemplate> <CustomNavigationTemplate> </CustomNavigationTemplate> </asp:TemplatedWizardStep> >"Is it possible to access navigation buttons in code without having to use When you use the TemplatedWizardStep, the button is defined explicitly, but TemplatedWizardSteps?" it is generated dynamically in the Wizard. So, this wasn't to access the button programmatically. >"What is the best way to make the Access keys on a wizard navigation button visible to the user and not give up the convienence of the wizard.NextButtonClick of the wizard control?" I can't understand the issue clearly. Could please give me some detail steps for this? Anyway, the html button is not working fine under this situation. I appreciate your understanding! Regards, Yuan Ren [MSFT] Microsoft Online Support Yuan thanks for your quick reply!
1) Unfortunately, all of my navigation controls are in the Navigation Template (Not the content template.) Also the ASP:Panel.DefaultButton does not accept an htmlButton (<Button>) (The Default button has to be an IButtonControl) And I believe I will need to use an HtmlButton so that I can have a button that supports markup to display my accessKeys. I tried to adapt your suggestion (Putting a panel surrounding navigational buttons in the navigation template) with <asp:button>s and it compiled but appeared to have no effect. I also tried adjusting the tabIndex thinking it might have a better effect within a panel but that didn’t seem to have an effect. I also attempted to put the panel around the whole wizard but got the same error that the default button had to be and IButtonControl. I have noticed that there are quite a few unanswered posts about setting a default button for a wizard control. 2) >"Is it possible to access navigation buttons in code without having to use TemplatedWizardSteps?" I don’t understand your response to this. I can access the navigation buttons programmatically if they are in a templatedWizardStep. I was asking if I really need to use a templatedWizardStep every time I need to access a navigation button programmatically. (Sometimes I need to add javascript, a dynamic tooltip, or a dynamic button text.) If I don’t need to use a templatedWizardStep how can I do this? I would like to be able to StepNextButton.Text=â€SomePageDependentNameHere†Or StepNextButton.Attributes("onClick") = "myJavaScriptFunctionHere();" (Note: Here I need to make changes to the button behavior in the code behind. So I could have NextStepButton text or javascript change when I’m on different steps in my wizard. It might also be a good place to change the validation group that button checks.) 3) >"What is the best way to make the Access keys on a wizard navigation button visible to the user and not give up the convenience of the wizard.NextButtonClick of the wizard control?" ex: I want to have a NextStepButton with the text property set to <u>N</u>ext. I would like to configure this button to raise an event that can be handled with: Protected Sub OnNext(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.WizardNavigationEventArgs) Handles Wizard1.NextButtonClick End sub This would give my code behind direct access to the WizardNavigationEventArgs. And I hope this would allow my pages to increment correctly without having to call the MoveTo function. Hi Jeff,
Thanks for your reply! For the first issue, the DefaultButton is only work for the content template. I suggest you send a feedback to the Microsoft using links below: https://support.microsoft.com/common/survey.aspx?scid=sw;en;1214&showpage=1& WS=mscom&url=http%3a%2f%2fwww.microsoft.com%2f For the second issue, we often add the attributes for the web control which likes the sample you supplied: StepNextButton.Attributes("onClick") = "myJavaScriptFunctionHere();" For the third issue, you can customize the behavior of the Wizard control by using custom code and events. For example, you can intercept the NextButtonClick event, which is raised when the user clicks the Next button and captures the data of the current step. The WizardNavigationEventArgs parameter passed to this event includes the CurrentStepIndex and NextStepIndex properties, enabling you to customize the behavior of the control based on the current and next steps, or to cancel the navigation when the Next button is clicked. Similarly, you can customize the behavior of the Previous and Finish buttons by using the PreviousButtonClick and FinishButtonClick events. Or you can perform cleanup when the Cancel button is clicked by using the CancelButtonClick event. I hope the information will be helpful! Regards, Yuan Ren [MSFT] Microsoft Online Support
Child control designers
InsertItemTemplate dependant dropdown list problem Disable Validator through Client-Site code Custom Datagrid not displaying TreeView with custom HierarchicalDataSourceControl Reading / Modifying FormView Child Controls at Runtime Custom Controls with UI Designer DataGrid event handlers are being lost during re-compile System.Web.UI.Design namespace not found Security exception while opening an OleDBConnection |
|||||||||||||||||||||||