Step 3 of 4: Add Code and Script to the Project
In the last steps you set up your project and a Window for ASP.NET AJAX dialog window. In this step you'll add code and JavaScript to your project to complete the project before running.
1. Switch to Source view and add the following JavaScript in just after the hyperlink tag to get and show a modeless dialog window:
<script type="text/javascript">
var form_dialog;
function openWindow(dialog)
{
form_dialog = dialog.control;
form_dialog.show();
}
</script>
For more information about modal and modeless dialog windows, see Modal and Modeless Dialog Windows.
2. Return to Design view and double-click on the Web page to switch to Code view and open the Page_Load event.
3. Add the following code to the Page_Load event to initialize the Hyperlink control:
' Set the open dialog window handler.
HyperLink1.NavigateUrl = String.Format("javascript:openWindow({0});", C1Window1.ClientID)
• C#
// Set the open dialog window handler.
HyperLink1.NavigateUrl = String.Format("javascript:openWindow({0});", C1Window1.ClientID);
You've completed step 3 of the Window for ASP.NET AJAX quick start guide. In the next step you'll run the project.
|