Article ID: 312572 - Last Review: June 14, 2002 - Revision: 1.0 PRB: You Cannot Navigate to a Specific Form By Using the #FormName Syntax
This article was previously published under Q312572 On This PageSYMPTOMS
When you set the NavigateURL property of the mobile link control to a page to which to navigate and to a form to display (such as: page2.aspx#myForm), the page navigates to the second page, but it does not navigate to the form that you have specified.
CAUSE
This behavior occurs because the Microsoft Mobile Internet Toolkit runtime does not parse the URL for a form name.
RESOLUTION
To resolve this behavior, use a QueryString variable, and then use server-side code to perform the navigation:
Create a Mobile Web Form with a Link ControlThe following code contains a mobile Link control that is used to navigate to the Page2.aspx page. Notice that the NavigateURL property of the control specifies the page to which to navigate. This property also contains the FormNavigateQueryString variable that you set equal to FormNavigate.Add the following code sample to an empty .aspx page on your Web server, and then name it Page1.aspx: Create a Mobile Web FormCreate a mobile Web Form to which to navigate.The following code contains two mobile Web Forms to which a user can navigate. The first form is rendered if a QueryString is not provided when this page is requested. The second form is rendered if a QueryString that is called FormNavigate has a value of Form2. Add the following code sample to an empty .aspx page, and then name it Page2.aspx: Process the QueryString with Microsoft Visual Basic .NETThe following code uses the Page_Load event to process the QueryString variable:To do this, the QueryString variable called FormNavigate is retrieved and then stored in a local variable called navigateToForm. If navigateToForm is not empty, the Page.FindControl using navigateToForm as the argument is called. A reference to the correct form is received, it is stored in a variable called myForm, and then the ActiveForm property is set equal to myForm. Add the following code sample to the Page2.aspx page after the code that you added in the "Create a Mobile Web Form" section: STATUSThis behavior is by design. MORE INFORMATIONSteps to Reproduce the BehaviorModify the solution code in Page1.aspx:Change the following line | Other Resources Other Support Sites
CommunityArticle Translations |






















Back to the top