Saturday, March 24, 2012

PagingBulletedListExtender not working anymore

After Beta 2 installation PagingBulletedListExtender is not working anymore, just creates one long bulleted list. And more, notorious error 'SYS is undefined'. All changes suggested in the migration to Beta2 guide done.

"Sys is undefined" almost always means ASP.NET AJAX isn't installed correctly. If the following from its release notes doesn't help, please follow up in one of the other ASP.NET AJAX forums:

* A new ScriptResource handler has been added that requires the following entry in the Web.config
file:

<add verb="GET"
path="ScriptResource.axd"
type="Microsoft.Web.Handlers.ScriptResourceHandler"
validate="false"/>

This handler requires an entry in the Web.config file. If the entry is missing, you might see the
following error:

'Sys' is undefined.


ScriptResource handler was added to web.config
Please reply with acomplete, simple, self-contained sample page that demonstrates the problem so that we can investigate the specific behavior you're seeing. Thank you!

<%@. Page Language="VB" AutoEventWireup="true" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Paging Bulleted List</title>
<link href="http://links.10026.com/?link=StyleSheet.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<div>

<ajaxToolkit:PagingBulletedListExtender ID="PBLE1" runat="server"
TargetControlID="BulletedList1"
ClientSort="true"
IndexSize="1"
Separator=" - "
SelectIndexCssClass="selectIndex"
UnselectIndexCssClass="unSelectIndex" />

<asp:BulletedList ID="BulletedList1" runat="server" DisplayMode="Text" DataSourceID="mySqlDataSource" DataTextField="CompanyName" DataValueField="CustomerId">
<asp:ListItem>Blur</asp:ListItem>
<asp:ListItem>Brand</asp:ListItem>
<asp:ListItem>Color</asp:ListItem>
</asp:BulletedList>

<asp:SqlDataSource ID="mySqlDataSource" runat="server" EnableCaching="true"
ConnectionString="<%$ ConnectionStrings:NorthWindConnectionString %>"
SelectCommand="SELECT CustomerId, CompanyName FROM customers" >
</asp:SqlDataSource>

</div>


</form>
</body>
</html>

=================

Web.Config :

...

<handlers>
<remove name="WebServiceHandlerFactory-ISAPI-2.0"/>
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="Microsoft.Web.Script.Services.ScriptHandlerFactory, Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
<add name="ScriptResource" verb="GET" path="ScriptResource.axd" type="Microsoft.Web.Handlers.ScriptResourceHandler" validate="false"/>
</handlers>
...


I removed the SQL and code-behind dependencies from the sample above and tried it in the SampleWebSite directory of the 61126 Toolkit where it appears to work fine to me:

<%@. Page Language="VB" AutoEventWireup="true" %><%@. Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head id="Head1" runat="server"> <title>Paging Bulleted List</title></head><body> <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server" /> <div> <ajaxToolkit:PagingBulletedListExtender ID="PBLE1" runat="server" TargetControlID="BulletedList1" ClientSort="true" IndexSize="1" Separator=" - " SelectIndexCssClass="selectIndex" UnselectIndexCssClass="unSelectIndex" /> <asp:BulletedList ID="BulletedList1" runat="server" DisplayMode="Text"> <asp:ListItem>Blur</asp:ListItem> <asp:ListItem>Brand</asp:ListItem> <asp:ListItem>Color</asp:ListItem> </asp:BulletedList> </div> </form></body></html>

Yes, it works. The problem was in my Web.config

I added before ScriptResource to the handlers of the section system.webServer, and now I added this ScriptResource to the httpHandlers of the system.web section.

Now it works perfect. Thank you.

No comments:

Post a Comment