IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

ASP.NET Ajax Discussion :

Erreur 500 CascadingDropdownList


Sujet :

ASP.NET Ajax

  1. #1
    Membre éclairé Avatar de DeWaRs
    Homme Profil pro
    Consultant informatique
    Inscrit en
    Décembre 2006
    Messages
    291
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Consultant informatique
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Décembre 2006
    Messages : 291
    Par défaut Erreur 500 CascadingDropdownList
    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
    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>
    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
    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
    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
    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>
    Merci d'avance de votre aide.

    DeWaRs

  2. #2
    Membre éclairé Avatar de DeWaRs
    Homme Profil pro
    Consultant informatique
    Inscrit en
    Décembre 2006
    Messages
    291
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France

    Informations professionnelles :
    Activité : Consultant informatique
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Décembre 2006
    Messages : 291
    Par défaut
    J'ai trouvé par moi meme, il me manquait un <WebMethod()> _ avant ma fonction GetCountry

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Erreur 500
    Par Neuromancien2 dans le forum Langage
    Réponses: 3
    Dernier message: 11/10/2005, 23h41
  2. XMLC_ReleaseXMLApplication : Erreur 500 ?
    Par Sylvain James dans le forum XMLRAD
    Réponses: 1
    Dernier message: 09/05/2005, 23h35
  3. [tomcat] Erreur 500 à l'appel de la servlet
    Par Kyti dans le forum Tomcat et TomEE
    Réponses: 26
    Dernier message: 06/04/2005, 09h37
  4. [web] [CGI][Easyphp] erreur 500
    Par nico72 dans le forum Web
    Réponses: 11
    Dernier message: 29/07/2004, 20h08
  5. Réponses: 6
    Dernier message: 28/10/2002, 11h34

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo