Hello, I'm trying to replicate the functionality presented here specific to the ModalPopup control:
http://ajax.asp.net/ajaxtoolkit/ModalPopup/ModalPopup.aspx
I've created a C# Ajax-enabled website project, have added the ScriptManager, ModalPopup, Panel and various Button controls, but although I've bound the ModalPopup to the button I want to have it use to activate my modal Panel, and though the project builds successfully, it doesn't react in the same way as the sample.
Here's the code from my skin file:
1<%@dotnet.itags.org. Page Language="C#" trace="true" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
23<%@dotnet.itags.org. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>45<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
6<html xmlns="http://www.w3.org/1999/xhtml">
7<head>
8 <title>Untitled Page</title>
9</head>
10<body>
1112 <form runat="server">
1314 <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true"></asp:ScriptManager>
15
16 <asp:Panel ID="Panel1" runat="server" Height="50px" Width="125px" Visible="False" >
17
18 <asp:Button ID="OkButton" runat="server" Text="OK"></asp:Button>
19 <asp:Button ID="CancelButton" runat="server" Text="Cancel"></asp:Button>
2021 </asp:Panel>
22
23 <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" runat="server"24 TargetControlID="btnAddServer"25 PopupControlID="Panel1"26 BackgroundCssClass="modalBackground"27 DropShadow="true"28 OkControlID="OkButton"29 OnOkScript="onOk()"30 CancelControlID="CancelButton" />
31
32 <br />
33 <center>
3435
36 <asp:Panel ID="PanelMain" runat="server" Height="25px" Width="125px" HorizontalAlign="Center">
37
38 <asp:Button ID="btnAddServer" runat="server" Text="Add" Width="33px" /></td>
39
40 </asp:Panel>
41
42 </form>
43
44</body>
45</html>
46
At this point, I'm guessing that the missing piece of the puzzle lies with the CSS stuff and/or the master page, as that I haven't brought over from the sample project utilizing ModalPopup. Can someone please help me pinpoint what I'm missing that is preventing this from working?
Thanks in advance for any help.
I found a fix which appears to work, but I'm still too much of a newbie to understand why. If someone could please explain I'd appreciate it.
After adding this to the "httpHandlers" section of my site project's Web.config file, my ModalPopup works:
<addverb="GET"path="ScriptResource.axd"type="Microsoft.Web.Handlers.ScriptResourceHandler"validate="false"/>
Thanks to this blogger: http://www.thecodinghumanist.com. The error I was encountering in the Javascript console (Firefox) was "Sys not defined", and the above appears to have addressed that, enabling the popup to work... somehow.
No comments:
Post a Comment