There is a problem with the Modal Popup control in the AJAX .NET Control Toolkit. The fix is not documented very well.
When the popup is shown, you can drag it around in the browser window if you specified its "PopupDragHandleControlID" in your code. However, when you release your mouse button, the poup box moves back to its original position automatically, --with animation, too!
It turns out that in their example, they added a piece of javascript to fix just this problem. The function is called "setBodyHeightToContentHeight", and it is specifed as a window resize handler. Even though the window is not resized when you move your popup box in the browser window, this will fix your problem.
Showing posts with label AJAX Control Toolkit. Show all posts
Showing posts with label AJAX Control Toolkit. Show all posts
Thursday, June 3, 2010
Wednesday, March 31, 2010
ReorderList in AJAX .NET Control Toolkit Requires ClientIDMode="AutoID"
When using "ReorderList" from AJAX .NET Control Toolkit, I found that it has a "hidden requirement": its "clientIDMode" attribute must be set to AutoID.
If you look at the AJAX .NET Control Toolkit sample website, its ReorderList sample does not have this attribute set. But the ReorderList sample works fine. How is that possible? It is because this sample site has "clientIDMode="AutoID" set in its web.config file:
<system.web>
...
<pages ... clientidmode="AutoID">
...
</system.web>
In other words, all controls in this sample website have this attribute set automatically!
What happens if you do not have this attribute set on a ReorderList control? Well, you will not be able to drap and drop items to reorder them. If you look at the HTML code that is generated, the "_behavior" attributes that are supposed to go to each "li" element in the item list all get piled onto a single "div" element on the outside, along with the "DraggableListItem" attribute. So when you try to drag an item in the list, you will either get no response, or a stop-sign icon.
If you look at the AJAX .NET Control Toolkit sample website, its ReorderList sample does not have this attribute set. But the ReorderList sample works fine. How is that possible? It is because this sample site has "clientIDMode="AutoID" set in its web.config file:
<system.web>
...
<pages ... clientidmode="AutoID">
...
</system.web>
In other words, all controls in this sample website have this attribute set automatically!
What happens if you do not have this attribute set on a ReorderList control? Well, you will not be able to drap and drop items to reorder them. If you look at the HTML code that is generated, the "_behavior" attributes that are supposed to go to each "li" element in the item list all get piled onto a single "div" element on the outside, along with the "DraggableListItem" attribute. So when you try to drag an item in the list, you will either get no response, or a stop-sign icon.
Monday, February 22, 2010
AJAX Control Toolkit and .NET 4.0
If you would like to build a .NET 4.0 web application with Visual Studio 2010, and you would like to build the AJAX Control Toolkit from its source with .NET 4.0 as well, you may run into a little problem. Even though you can build the AJAX Control Toolkit itself just fine, but when you build your web application, the compiler will give an error: "Inheritance security rules violated by type: 'AjaxControlToolkit.TabPanelDesigner'. Derived types must either match the security accessibility of the base type or be less accessible."
A quick solution to this problem is to add the following to the "AssemblyInfo.cs" file of the AJAX Control Toolkit project (not your own web application project):
[assembly: SecurityRules(SecurityRuleSet.Level1)]
Of course, at the beginning of this file, make sure that you have
using System.Security;
After you have made these changes, rebuild the AJAX Control Toolkit, and then your web application. Your web application should build fine.
A quick solution to this problem is to add the following to the "AssemblyInfo.cs" file of the AJAX Control Toolkit project (not your own web application project):
[assembly: SecurityRules(SecurityRuleSet.Level1)]
Of course, at the beginning of this file, make sure that you have
using System.Security;
After you have made these changes, rebuild the AJAX Control Toolkit, and then your web application. Your web application should build fine.
Update: A later build of AJAX Control Toolkit now works with Visual Studio 2010 without modification.
Subscribe to:
Posts (Atom)