The samplewebsite of the AJAX toolkit is a C# single page model. I wanted to convert it to VB and a code-behind model and post it here, in thanks for all the help this forum has been to me. I was converting the modal popup, and it runs fine, but is not draggable.
When released, it returns to the original position, which the samplewebsite does not do. I'm going crazy trying to see what's different. I give up..if any one can see what's wrong, thanks in advance...[cool]
<%@ Page Language="VB" AutoEventWireup="true" Title="ModalPopup Sample" CodeFile="ModalPopup.aspx.vb" Inherits="ModalPopup" %>
<%@ Register
Assembly="AjaxControlToolkit"
Namespace="AjaxControlToolkit"
TagPrefix="ajaxToolkit" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Modal" runat="server" >
<link href="StyleSheet.css" rel="stylesheet" type="text/css" />
</head>
<body style="background-color: white;">
<form id="form1" method="post" runat="server">
<ajaxToolkit:ToolkitScriptManager runat="Server" ID="ScriptManager1" />
<div>
This ModalPopup will be spawned programmatically. The ModalPopupExtender that this popup is attached to
has a hidden TargetControl. The popup can be shown via server in code behind and
by calling the ModalPopupExtender methods to show and hide.<br />
<asp:Button runat="server" ID="hiddenTargetControlForModalPopup" style="display:none"/>
<ajaxToolkit:ModalPopupExtender runat="server" ID="programmaticModalPopup"
BehaviorID="programmaticModalPopupBehavior"
TargetControlID="hiddenTargetControlForModalPopup"
PopupControlID="programmaticPopup"
BackgroundCssClass="modalBackground"
DropShadow="True"
PopupDragHandleControlID="programmaticPopupDragHandle"
RepositionMode="RepositionOnWindowScroll" >
</ajaxToolkit:ModalPopupExtender>
<asp:Panel runat="server" CssClass="modalPopup" ID="programmaticPopup" style="display:none;width:350px;padding:10px">
<asp:Panel runat="Server" ID="programmaticPopupDragHandle"
Style="cursor: move;background-color:#DDDDDD;border:solid 1px Gray;
color:Black;text-align:center;">
<div>
<p>ModalPopup cant be dragged..why?</p>
</div>
</asp:Panel>
You can now use this sample to see how to use ModalPopup with an invisible TargetControl. The ModalPopupExtender
this popup is attached to has a hidden target control. The popup is hidden
on the server side in code behind and on the client in script.
<br />
</asp:Panel>
</div>
</form>
</body>
</html>
Partial
Class ModalPopup
Inherits System.Web.UI.Page
Private
Sub Page_Load(ByVal sender
As
Object,
ByVal e
As System.EventArgs)
Handles
Me.Load
Me.programmaticModalPopup.Show()
End
Sub
BGriffin_TPA
Member
489 Points
311 Posts
Converting the SampleWebsite to VB and partial Class
Mar 02, 2009 10:12 PM|LINK
The samplewebsite of the AJAX toolkit is a C# single page model. I wanted to convert it to VB and a code-behind model and post it here, in thanks for all the help this forum has been to me. I was converting the modal popup, and it runs fine, but is not draggable. When released, it returns to the original position, which the samplewebsite does not do. I'm going crazy trying to see what's different. I give up..if any one can see what's wrong, thanks in advance...[cool]
===============================================================
<%@ Page Language="VB" AutoEventWireup="true" Title="ModalPopup Sample" CodeFile="ModalPopup.aspx.vb" Inherits="ModalPopup" %> <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Modal" runat="server" > <link href="StyleSheet.css" rel="stylesheet" type="text/css" /> </head> <body style="background-color: white;"> <form id="form1" method="post" runat="server"> <ajaxToolkit:ToolkitScriptManager runat="Server" ID="ScriptManager1" /> <div> This ModalPopup will be spawned programmatically. The ModalPopupExtender that this popup is attached to has a hidden TargetControl. The popup can be shown via server in code behind and by calling the ModalPopupExtender methods to show and hide.<br /> <asp:Button runat="server" ID="hiddenTargetControlForModalPopup" style="display:none"/> <ajaxToolkit:ModalPopupExtender runat="server" ID="programmaticModalPopup" BehaviorID="programmaticModalPopupBehavior" TargetControlID="hiddenTargetControlForModalPopup" PopupControlID="programmaticPopup" BackgroundCssClass="modalBackground" DropShadow="True" PopupDragHandleControlID="programmaticPopupDragHandle" RepositionMode="RepositionOnWindowScroll" > </ajaxToolkit:ModalPopupExtender> <asp:Panel runat="server" CssClass="modalPopup" ID="programmaticPopup" style="display:none;width:350px;padding:10px"> <asp:Panel runat="Server" ID="programmaticPopupDragHandle" Style="cursor: move;background-color:#DDDDDD;border:solid 1px Gray; color:Black;text-align:center;"> <div> <p>ModalPopup cant be dragged..why?</p> </div> </asp:Panel> You can now use this sample to see how to use ModalPopup with an invisible TargetControl. The ModalPopupExtender this popup is attached to has a hidden target control. The popup is hidden on the server side in code behind and on the client in script. <br /> </asp:Panel> </div> </form> </body> </html>==========================================================
Partial Class ModalPopup Inherits System.Web.UI.Page Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Me.programmaticModalPopup.Show() End SubEnd
ClassDanny117
Star
11160 Points
1932 Posts
Re: Converting the SampleWebsite to VB and partial Class
Mar 03, 2009 01:18 PM|LINK
Sometimes there no room to move. So you just add some height to the body tag or div tag somewhere on the page.
<body style="background-color: white; height: 800px;">
Me on linked in
BGriffin_TPA
Member
489 Points
311 Posts
Re: Converting the SampleWebsite to VB and partial Class
Mar 03, 2009 03:32 PM|LINK
You are correct!..I'd have been pulling my hair out for days before seeing that..Thanks! [cool]