Bonjour a tous,
Pour un projet de developpement de WebApplication, je suis en train d'essayé de faire des cascading dropdownlist via le toolkit AjaxControlToolkit. J'ai suivit l'aide suivante mais je bloque. En effet, j'ai une erreur 500 lorsque j’exécute mon projet. Je pense pourtant ne rien avoir oublier. Quelqu'un voit-il ou je me suis planté ?
Voici mes sources :
cascad.aspx
cascad.asmx.vb
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36 <%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="~/cascad.asmx.vb" Inherits="Cascading2.WebForm1" EnableEventValidation="false" %> <%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="asp" %> <asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server"> </asp:Content> <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <p> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <br /> Country : <asp:DropDownList ID="DDLCountry" runat="server"> </asp:DropDownList> <asp:CascadingDropDown ID="DDLCountry_CascadingDropDown" runat="server" TargetControlID="DDLCountry" Category="Country" PromptText="Select a country" ServiceMethod="GetCountry" ServicePath="~/cascad.asmx"> </asp:CascadingDropDown> <br /><br /> Building : <asp:DropDownList ID="DDLBuilding" runat="server"> </asp:DropDownList> <asp:CascadingDropDown ID="DDLBuilding_CascadingDropDown" runat="server" TargetControlID="DDLBuilding" Category="Building" ParentControlID="DDLCountry" ServiceMethod="GetCountry" ServicePath="~/cascad.asmx" PromptText="Select Building"> </asp:CascadingDropDown> <br /><br /> </p> </asp:Content>
et enfin le web.config
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47 Imports System.Web.Services Imports System.Web.Services.Protocols Imports System.ComponentModel Imports System Imports System.Web Imports System.Collections Imports System.Collections.Generic Imports System.Collections.Specialized Imports AjaxControlToolkit Imports System.Configuration Imports System.Data Imports System.Data.SqlClient ' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. <System.Web.Script.Services.ScriptService()> _ <System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _ <System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _ <ToolboxItem(False)> _ Public Class cascad Inherits System.Web.Services.WebService Public Shared Function GetCountry(ByVal knownCategoryValues As String, ByVal category As String) As CascadingDropDownNameValue() Dim strConnection As String = ConfigurationManager.ConnectionStrings("IT_Rent_connection").ConnectionString Dim sqlConn As SqlConnection = New SqlConnection(strConnection) Dim strConfQuery As String = "SELECT * FROM COUNTRY" Dim cmdFetchConf As SqlCommand = New SqlCommand(strConfQuery, sqlConn) Dim dtrConf As SqlDataReader Dim myConferences As New List(Of CascadingDropDownNameValue) sqlConn.Open() dtrConf = cmdFetchConf.ExecuteReader While dtrConf.Read() Dim strConfName As String = dtrConf("name_country").ToString Dim strConfId As String = dtrConf("id_country").ToString myConferences.Add(New CascadingDropDownNameValue(strConfName, strConfId)) End While Return myConferences.ToArray End Function End Class
Merci d'avance de votre aide.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51 <?xml version="1.0" encoding="utf-8"?> <!-- For more information on how to configure your ASP.NET application, please visit http://go.microsoft.com/fwlink/?LinkId=169433 --> <configuration> <connectionStrings> <add name="IT_Rent_connection" connectionString="Data Source=LVLD60215571A;Initial Catalog=IT_RENT;Integrated Security=True" providerName="System.Data.SqlClient" /> <add name="ApplicationServices" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" /> </connectionStrings> <system.web> <compilation debug="true" strict="false" explicit="true" targetFramework="4.0"> <assemblies> <add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" /> <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /> </assemblies> </compilation> <authentication mode="Forms"> <forms loginUrl="~/Account/Login.aspx" timeout="2880" /> </authentication> <membership> <providers> <clear /> <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" /> </providers> </membership> <profile> <providers> <clear /> <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" /> </providers> </profile> <roleManager enabled="false"> <providers> <clear /> <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" /> <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" /> </providers> </roleManager> <pages> <controls> <add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" /> </controls> </pages> </system.web> <system.webServer> <modules runAllManagedModulesForAllRequests="true" /> </system.webServer> </configuration>
DeWaRs
Partager