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 Discussion :

Pourquoi ai-je une erreur à la redirection ?


Sujet :

ASP.NET

  1. #1
    Membre confirmé
    Profil pro
    Inscrit en
    Mars 2004
    Messages
    66
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2004
    Messages : 66
    Par défaut Pourquoi ai-je une erreur à la redirection ?
    Bonjour a tous
    voial mon probelme
    j'utlise la fonction
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
     Response.Write("<body><script>window.open('" & str_URL & "')</script></body>")
    mais ca génere l'erreur suivante:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    String constants must end with a double quote.
    et je ne vois pas d'ou viens le probelme
    sachant que str_URL peut etre une adresse web ou un lien vers un fichier.

    meci de votre aide

  2. #2
    Membre émérite Avatar de cubitus91
    Homme Profil pro
    Consultant informatique
    Inscrit en
    Mai 2004
    Messages
    726
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : France

    Informations professionnelles :
    Activité : Consultant informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mai 2004
    Messages : 726
    Par défaut
    Salut,
    Essaie plutot ca, ca marchera mieux je pense.
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    Response.Write("<body><script>window.open("" & str_URL & "")</script></body>")

    Cdt

  3. #3
    Membre confirmé
    Profil pro
    Inscrit en
    Mars 2004
    Messages
    66
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2004
    Messages : 66
    Par défaut
    merci cubitus91 pour ton aide
    mais c tjr le meme probleme
    j'ai tt tester ss resultat
    aidez moi svp

  4. #4
    Membre émérite Avatar de cubitus91
    Homme Profil pro
    Consultant informatique
    Inscrit en
    Mai 2004
    Messages
    726
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : France

    Informations professionnelles :
    Activité : Consultant informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mai 2004
    Messages : 726
    Par défaut
    Comment tu affecte ta valeur à str_url

  5. #5
    Membre émérite Avatar de cubitus91
    Homme Profil pro
    Consultant informatique
    Inscrit en
    Mai 2004
    Messages
    726
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : France

    Informations professionnelles :
    Activité : Consultant informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mai 2004
    Messages : 726
    Par défaut
    Oups sorry je me suis trompé c est pas
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    Response.Write("<body><script>window.open("" & str_URL & "")</script></body>")
    Mais plutot

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    Response.Write("<body><script>window.open(""" & str_URL & """)</script></body>")
    Fais voir comment tu affectes ta valeur str_URL à ton string.

  6. #6
    Membre confirmé
    Profil pro
    Inscrit en
    Mars 2004
    Messages
    66
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2004
    Messages : 66
    Par défaut
    re slt
    j'ai essaye a nouveau la nvlle mais tjr la meme erreur
    donc pour la valeur str_URL, je la recupere d'une datagrid;commen ca:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    Dim str_URL As String = e.Item.Cells(2).text
    encore grd merci

  7. #7
    Membre émérite Avatar de cubitus91
    Homme Profil pro
    Consultant informatique
    Inscrit en
    Mai 2004
    Messages
    726
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : France

    Informations professionnelles :
    Activité : Consultant informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mai 2004
    Messages : 726
    Par défaut
    Renvoie un response.write(str_URL) pour voir !!

  8. #8
    Membre confirmé
    Profil pro
    Inscrit en
    Mars 2004
    Messages
    66
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2004
    Messages : 66
    Par défaut
    franchement je ne sais plus koi faire!!
    juste pour information j'utilise WebMatrix est ke a ton avis c poserai probleme
    en tt cas merci bcp pour ton aide

  9. #9
    Membre émérite Avatar de cubitus91
    Homme Profil pro
    Consultant informatique
    Inscrit en
    Mai 2004
    Messages
    726
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : France

    Informations professionnelles :
    Activité : Consultant informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mai 2004
    Messages : 726
    Par défaut
    Je ne pense pas , mais je ne connais pas du tout WebMatrix.
    Désolé.

    Donne un peu d info sur ton Datagrid , car a mon avis ton erreur vient de la !! Donne aussi le resultat du Response.wite(str_URL) pour un fichier et un lien stp .

  10. #10
    Membre confirmé
    Profil pro
    Inscrit en
    Mars 2004
    Messages
    66
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2004
    Messages : 66
    Par défaut
    voila mon code pour tt la page!!

    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
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
     
    <%@ Page Language="VB" %>
    <script runat="server">
     
        public int_Num_SSMenu as integer
     
     
        Sub Page_Load()
     
     
                fct_AfficherListe
     
        end sub
     
     
        sub fct_AfficherListe()
     
     
     
             Dim obj_Connection As System.Data.SqlClient.SqlConnection
             Dim obj_Command As System.Data.SqlClient.SqlCommand
             Dim obj_DataReader As System.Data.SqlClient.SQLDataReader
             Dim sSQL As String
     
     
             obj_Connection = New System.Data.SqlClient.SqlConnection()
             obj_Connection.ConnectionString = "Server=(local); Initial Catalog='bd_PORTAIL_CWI';" _
                     & " Trusted_Connection=True;"
     
     
             obj_Connection.Open()
     
     
             sSQL = "SELECT * FROM tbl_URL WHERE FK_NUM_SS_MENU = '" & Request.Params("ssmenu") & "'"
     
     
             obj_Command = New System.Data.SqlClient.SqlCommand(sSQL, obj_Connection)
     
     
             obj_DataReader = obj_Command.ExecuteReader()
     
             grd_URL.DataSource = obj_DataReader
             grd_URL.DataBind()
     
             obj_DataReader.Close()
             obj_Connection.Close()
     
        end sub
     
        Sub Ouvrir_URL(sender As Object, e As DataGridCommandEventArgs)
     
                'if e.Item.ItemIndex <> -1 then
                    'Dim str_URL As String
                    'str_URL = e.Item.Cells(2).text
                    'Response.Redirect("toto")
     
                    Response.Write("http://fr.yahoo.com/")
     
                'end if
     
        End Sub
     
     
        '
     
    </script>
    <html>
    <head>
        <meta content="Visual Basic 7.0" name="CODE_LANGUAGE" />
    </head>
    <body>
        <form runat="server">
            <p align="center">
            </p>
            <p align="center">
            </p>
            <p align="center">
            </p>
            <p align="center">
                <asp:DataGrid id="grd_URL" runat="server" AutoGenerateColumns="False" BorderStyle="None" GridLines="Vertical" BorderWidth="1px" BorderColor="#999999" BackColor="White" CellPadding="3" OnItemCommand="Ouvrir_URL" Width="472px">
                    <FooterStyle forecolor="Black" backcolor="#CCCCCC"></FooterStyle>
                    <HeaderStyle font-bold="True" forecolor="White" backcolor="#000084"></HeaderStyle>
                    <PagerStyle horizontalalign="Center" forecolor="Black" backcolor="#999999" mode="NumericPages"></PagerStyle>
                    <SelectedItemStyle font-bold="True" forecolor="White" backcolor="#008A8C"></SelectedItemStyle>
                    <AlternatingItemStyle backcolor="Gainsboro"></AlternatingItemStyle>
                    <ItemStyle forecolor="Black" backcolor="#EEEEEE"></ItemStyle>
                    <Columns>
                        <asp:BoundColumn Visible="False" DataField="PK_NUM_URL" HeaderText="ID"></asp:BoundColumn>
                        <asp:BoundColumn DataField="VCH_NOM" HeaderText="Lien"></asp:BoundColumn>
                        <asp:BoundColumn Visible="False" DataField="VCH_URL" HeaderText="Lien"></asp:BoundColumn>
                        <asp:BoundColumn DataField="VCH_DESCRIPTION" HeaderText="Description"></asp:BoundColumn>
                        <asp:ButtonColumn Text="Ouvrir" CommandName="Ouvrir_URL"></asp:ButtonColumn>
                    </Columns>
                </asp:DataGrid>
                <!-- Insert content here -->
            </p>
        </form>
    </body>
    </html>

    et qd je fait un response.write("un lien qq onque")
    il affiche le lien en haut de la page.



  11. #11
    Membre émérite Avatar de cubitus91
    Homme Profil pro
    Consultant informatique
    Inscrit en
    Mai 2004
    Messages
    726
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : France

    Informations professionnelles :
    Activité : Consultant informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mai 2004
    Messages : 726
    Par défaut
    Met ta colonne 2 en lecteur seul

  12. #12
    Membre émérite Avatar de cubitus91
    Homme Profil pro
    Consultant informatique
    Inscrit en
    Mai 2004
    Messages
    726
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : France

    Informations professionnelles :
    Activité : Consultant informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mai 2004
    Messages : 726
    Par défaut
    Lecture Seule je voulais dire pardon


    Je regarde pour le reste

  13. #13
    Membre confirmé
    Profil pro
    Étudiant
    Inscrit en
    Avril 2006
    Messages
    86
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations professionnelles :
    Activité : Étudiant

    Informations forums :
    Inscription : Avril 2006
    Messages : 86
    Par défaut
    Et su tu essayes ça :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    Response.Write("<body><script>window.open(""" & str_URL & """);</script></body>")
    Il y a le point virgule en plus.

  14. #14
    Membre confirmé
    Profil pro
    Inscrit en
    Mars 2004
    Messages
    66
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2004
    Messages : 66
    Par défaut
    merci a tous


    cubitus91 j'ai mis la colone en lecture seul, ca ne change rien!!


    davasm cette syntaxe, je l'ai deja essaye!!!


    je suis sur et certain que le probleme viens du javascript, il n'aime pas trop
    parce que qd j'utilise ca marche pour les lien web (pas les liens vers les fichiers) mais ca l'affiche ds la meme frame!! et ca le patron n'on veut pas

  15. #15
    Membre émérite Avatar de cubitus91
    Homme Profil pro
    Consultant informatique
    Inscrit en
    Mai 2004
    Messages
    726
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : France

    Informations professionnelles :
    Activité : Consultant informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mai 2004
    Messages : 726
    Par défaut
    Ce qui est Bizard c est que moi j ai la meme fct au taf et ca marche bien j arrive à ouvrir une fenetre (popup).
    Essaie ca !
    [CODE]
    Response.Write("<script language='JavaScript'>window.open(""" & str_URL & """,'PopUp','location=no,toolbar=no,status=no,menubar=no,scrollbars=yes,resizable=yes')<" & "/script>")

  16. #16
    Membre confirmé
    Profil pro
    Inscrit en
    Mars 2004
    Messages
    66
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2004
    Messages : 66
    Par défaut
    bah j'ai tt essaye
    maais la je desespere!!

  17. #17
    Membre émérite Avatar de cubitus91
    Homme Profil pro
    Consultant informatique
    Inscrit en
    Mai 2004
    Messages
    726
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 43
    Localisation : France

    Informations professionnelles :
    Activité : Consultant informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Mai 2004
    Messages : 726

  18. #18
    Membre confirmé
    Profil pro
    Inscrit en
    Mars 2004
    Messages
    66
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Mars 2004
    Messages : 66
    Par défaut
    Bonsoir
    je te remercie infiniment de ton aide
    grd merci
    j'ai resolu le probelme en fin de compte
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
     
                str_URL = "<body><script>window.open('" & str_URL & "')<" & "/script></body>"
                Response.Write(str_URL)
    c un peu con non
    mais bon le resultat est la et c'est l'essentiel
    merci
    a bientot

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

Discussions similaires

  1. Réponses: 5
    Dernier message: 04/01/2008, 09h55
  2. Réponses: 7
    Dernier message: 29/06/2006, 08h54
  3. [VB.Net] Pourquoi ai-je une erreur à l'exécution d'une requête ?
    Par zooffy dans le forum Accès aux données
    Réponses: 3
    Dernier message: 25/06/2006, 10h35
  4. [C# 2.0] Pourquoi ai-je une erreur à l'exécution d'un Filter Databind ?
    Par diaboloche dans le forum Accès aux données
    Réponses: 5
    Dernier message: 24/06/2006, 18h57
  5. [ADO.Net][Access] Pourquoi ai-je une erreur lors de l'Update ?
    Par nazimb dans le forum Accès aux données
    Réponses: 1
    Dernier message: 15/05/2006, 09h37

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