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 :

Executer code behind avant affichage d'un modalpopupextender


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 Executer code behind avant affichage d'un modalpopupextender
    Bonjour a tous,

    J'ai un petit soucis. J'utilise un formulaire pour enregistrer des données, et je voudrais que, lorsque tout c'est bien passé, afficher un popup grace au ajaxtoolkit modalpopupextender. Le probleme est que, lorsque j'associe mon bouton a une fonction Onclick et au popup, rien ne se passe. Quelqu'un a-t-il une solution ?

    Voici mon code

    la page asp
    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
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    <%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master"
        CodeBehind="BookITAccessories.aspx.vb" Inherits="IRE.BookITAccessories" EnableEventValidation="false"
        ValidateRequest="false" %>
     
    <asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    </asp:Content>
    <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
        <link href="Styles/StyleSheet.css" rel="stylesheet" type="text/css" />
        <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true">
        </asp:ScriptManager>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:IT_Rent_connection %>"
            SelectCommand="SELECT * FROM [tblAccessories] ORDER BY [IdAccessories] DESC">
        </asp:SqlDataSource>
        <asp:Panel ID="Panel2" runat="server">
            <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                <ContentTemplate>
                    <asp:Panel ID="Panel1" runat="server" Height="426px" Width="937px">
                        <table style="width: 46%; caption-side: bottom; empty-cells: hide; height: 432px;"
                            align="center">
                            <tr>
                                <td class="Table_soft">
                                    <asp:Label ID="Label1" runat="server" Text="User ID :" class="Label"></asp:Label>
                                </td>
                                <td class="Table_soft">
                                    &nbsp;<asp:TextBox ID="tbUserID" runat="server" AutoPostBack="True"></asp:TextBox>
                                    &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<asp:ImageButton ID="ImageButton1"
                                        runat="server" ImageUrl="~/imgs/search.gif" CausesValidation="False" />
                                    &nbsp;
                                </td>
                            </tr>
                            <tr>
                                <td class="Table_hard">
                                    <asp:Label ID="Label2" runat="server" Text="First Name :" class="Label"></asp:Label>
                                </td>
                                <td class="Table_hard">
                                    <asp:Label ID="LabelFirstName" runat="server"></asp:Label>
                                    <asp:CustomValidator ID="CustomValidator1" runat="server" Display="Dynamic" ErrorMessage="Please select a user !"
                                        ValidationGroup="ValidAttrib"></asp:CustomValidator>
                                </td>
                            </tr>
                            <tr>
                                <td class="Table_soft">
                                    <asp:Label ID="Label3" runat="server" Text="Last Name :" class="Label"></asp:Label>
                                </td>
                                <td class="Table_soft">
                                    <asp:Label ID="LabelLastName" runat="server"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td class="Table_hard">
                                    <asp:Label ID="Label4" runat="server" Text="Cost Center :" class="Label"></asp:Label>
                                </td>
                                <td class="Table_hard">
                                    <asp:Label ID="LabelCostCenter" runat="server"></asp:Label>
                                </td>
                            </tr>
                            <tr>
                                <td class="Table_soft">
                                    <asp:Label ID="Label5" runat="server" Text="Building :" class="Label"></asp:Label>
                                </td>
                                <td class="Table_soft">
                                    <asp:DropDownList ID="DDLBuilding" runat="server">
                                    </asp:DropDownList>
                                    <ajaxToolkit:CascadingDropDown ID="DDLBuilding_CascadingDropDown" runat="server"
                                        TargetControlID="DDLBuilding" Category="IdBuilding" ServiceMethod="GetBuilding"
                                        ServicePath="~/Cascad.asmx" PromptText="Select Building" PromptValue="0">
                                    </ajaxToolkit:CascadingDropDown>
                                    <asp:CompareValidator ID="CompareValidatorBuilding" ControlToValidate="DDLBuilding"
                                        Operator="NotEqual" ValueToCompare="0" ErrorMessage="Please select building"
                                        runat="server" Display="None" ValidationGroup="ValidAttrib"></asp:CompareValidator>
                                </td>
                            </tr>
                            <tr>
                                <td class="Table_soft">
                                    <asp:Label ID="Label7" runat="server" Text="IT Accessories"></asp:Label>
                                </td>
                                </td>
                                <td class="Table_soft">
                                    <asp:DropDownList ID="DDLAccessories" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource1"
                                        DataTextField="AccessoriesName" DataValueField="IdAccessories">
                                    </asp:DropDownList>
                                    <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToValidate="DDLAccessories"
                                        Display="None" ErrorMessage="Please Select a material" Operator="NotEqual" ValidationGroup="ValidAttrib"
                                        ValueToCompare="0"></asp:CompareValidator>
                                    <ajaxToolkit:ValidatorCalloutExtender ID="CompareValidator1_ValidatorCalloutExtender"
                                        runat="server" Enabled="True" TargetControlID="CompareValidator1">
                                    </ajaxToolkit:ValidatorCalloutExtender>
                                </td>
                            </tr>
                            <tr>
                                <td>
                                    <asp:Label ID="LabelOther" runat="server" Text="Other :" Visible="False"></asp:Label>
                                </td>
                                <td>
                                    <asp:TextBox ID="TBOther" runat="server" Visible="False"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td class="Table_hard">
                                    <asp:Label ID="Label8" runat="server" Text="Return Date" class="Label"></asp:Label>
                                </td>
                                <td class="Table_hard">
                                    <asp:TextBox ID="TBReturnDate" runat="server" Height="16px" Width="167px"></asp:TextBox>
                                    <ajaxToolkit:CalendarExtender ID="TBReturnDate_CalendarExtender" runat="server" Enabled="True"
                                        TargetControlID="TBReturnDate" FirstDayOfWeek="Monday" PopupButtonID="IBTStartDate"
                                        Format="dd/MM/yyyy" PopupPosition="Right">
                                    </ajaxToolkit:CalendarExtender>
                                    <asp:ImageButton ID="IBTStartDate" runat="server" ImageUrl="~/imgs/Calendar_scheduleHS.png"
                                        CausesValidation="False" />
                                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TBReturnDate"
                                        Display="None" ErrorMessage="For a booking, you need to specifie a return date"
                                        ValidationGroup="ValidBooking"></asp:RequiredFieldValidator>
                                    <ajaxToolkit:ValidatorCalloutExtender ID="RequiredFieldValidator1_ValidatorCalloutExtender"
                                        runat="server" Enabled="True" TargetControlID="RequiredFieldValidator1">
                                    </ajaxToolkit:ValidatorCalloutExtender>
                                </td>
                            </tr>
                            <tr>
                                <td class="Table_hard">
                                    <asp:Label ID="Label10" runat="server" Text="Comment :" class="Label"></asp:Label>
                                </td>
                                <td class="Table_hard">
                                    <asp:TextBox ID="TBComment" runat="server" Height="90px" TextMode="MultiLine" Width="165px">
                                    </asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td class="style11">
                                    &nbsp;
                                </td>
                                <td class="style3">
                                    &nbsp;<asp:Button ID="btAttrib" runat="server" CssClass="Bouton_blue" Text="Attribution" />
                                    &nbsp;&nbsp;&nbsp;
                                    <asp:Button ID="BTBooking" runat="server" CssClass="Bouton_blue" Text="Booking" ValidationGroup="ValidBooking" />
                                    <ajaxToolkit:ModalPopupExtender ID="BTBooking_ModalPopupExtender" runat="server"
                                        DynamicServicePath="" Enabled="True" TargetControlID="BTBooking" PopupControlID="panelConfirm"
                                        BackgroundCssClass="modalBackground" DropShadow="true" CancelControlID="btClose"
                                        OkControlID="BTBooking">
                                    </ajaxToolkit:ModalPopupExtender>
                                </td>
                            </tr>
                        </table>
                    </asp:Panel>
                    <asp:Panel ID="DualLoginAtempt" runat="server" Height="167px" Width="530px" CssClass="modalPopup">
                        <ajaxToolkit:ModalPopupExtender ID="mpeDualLoginAtempt" runat="server" BackgroundCssClass="modalBackground"
                            CancelControlID="btnDualLoginAtempt" PopupControlID="DualLoginAtempt" TargetControlID="ImageButton1"
                            DropShadow="true">
                        </ajaxToolkit:ModalPopupExtender>
                        <asp:UpdatePanel ID="udpOutterUpdatePanel" runat="server" UpdateMode="Conditional">
                            <ContentTemplate>
                                <div id="divControlContainer" runat="server">
                                </div>
                                <input id="dummy" type="button" style="display: none" runat="server" />
                                <table align="center">
                                    <tr>
                                        <td class="Table_soft">
                                            <asp:Label ID="Label11" runat="server" Text="User ID :" class="Label"></asp:Label>
                                        </td>
                                        <td class="Table_soft">
                                            <asp:TextBox ID="TBUser" runat="server" ValidationGroup="SearchValidation">
                                            </asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="Table_hard">
                                            <asp:Label ID="Label12" runat="server" Text="First Name :" class="Label"></asp:Label>
                                        </td>
                                        <td class="Table_hard">
                                            <asp:TextBox ID="TBFirst" runat="server" ValidationGroup="SearchValidation">
                                            </asp:TextBox>
                                        </td>
                                        <td class="Table_hard">
                                            <asp:CustomValidator ID="CValFirst" runat="server" Display="Dynamic" ErrorMessage="You need to enter userid or firstname or lastname"
                                                ValidationGroup="SearchValidation"></asp:CustomValidator>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="Table_soft">
                                            <asp:Label ID="Label13" runat="server" Text="Last Name :" class="Label"></asp:Label>
                                        </td>
                                        <td class="Table_soft">
                                            <asp:TextBox ID="TBLast" runat="server" ValidationGroup="SearchValidation"></asp:TextBox>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td class="white">
                                            <asp:Button ID="BTCheck" runat="server" Text="Search" class="Bouton_orange" ValidationGroup="SearchValidation" />
                                        </td>
                                        <td class="Table_hard">
                                            <asp:DropDownList ID="DDLUser" runat="server">
                                            </asp:DropDownList>
                                        </td>
                                    </tr>
                                </table>
                            </ContentTemplate>
                        </asp:UpdatePanel>
                        <table id="Table1" runat="server" align="right">
                            <tr>
                                <td>
                                    <asp:Button ID="BTValid" runat="server" Text="Valid" CausesValidation="False" class="Bouton_orange"
                                        CssClass="Bouton_blue" Visible="False" />
                                </td>
                                <td>
                                    <asp:Button ID="btnDualLoginAtempt" runat="server" Text="Close" CausesValidation="False"
                                        class="Bouton_orange" />
                                </td>
                            </tr>
                        </table>
                    </asp:Panel>
                </ContentTemplate>
            </asp:UpdatePanel>
            <asp:Panel ID="panelConfirm" runat="server" CssClass="modalPopup">
                Your request has been accepted !
                <br />
                <asp:Button ID="btClose" runat="server" Text="Close" CssClass="Bouton_orange" />
            </asp:Panel>
        </asp:Panel>
    </asp:Content>
    Ma fonction onclick 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
        Protected Sub BTBooking_Click(ByVal sender As Object, ByVal e As EventArgs) Handles BTBooking.Click
     
            Page.Validate("ValidAttrib")
            Page.Validate("ValidBooking")
            If Page.IsValid Then
     
                Dim IdITemsIT As String = "'" & DDLAccessories.SelectedValue & "',"
                Dim IsAttribution As String = "'" & "0" & "',"
                Dim RetunDate As String = "'" & TBReturnDate.Text & "',"
                Dim UserID As String = "'" & tbUserID.Text & "',"
                Dim FirstName As String = "'" & LabelFirstName.Text & "',"
                Dim LastName As String = "'" & LabelLastName.Text & "',"
                Dim IdBuilding As String = "'" & DDLBuilding.SelectedValue & "',"
                Dim Comment As String = "'" & TBComment.Text & "',"
                Dim Other As String = "'" & TBOther.Text & "',"
                Dim IsReturn As String = "0,"
                Dim EUSID As String = System.Security.Principal.WindowsIdentity.GetCurrent().Name
                EUSID = Replace(EUSID, "SAP_ALL\", "")
                EUSID = "'" & EUSID & "'"
     
                Dim strConnection As String = ConfigurationManager.ConnectionStrings("IT_Rent_connection").ConnectionString
                Dim sqlConn As SqlConnection = New SqlConnection(strConnection)
                Dim strTeamQuery As String = "Insert into tblAccessoriesBook (IdAccessories, IsAttribution, ReturnDate, IsReturn, UserID, FirstName, LastName, IdBuilding, Comment, Other, EUSID) VALUES(" _
                                             & IdITemsIT & IsAttribution & RetunDate & IsReturn & UserID & FirstName & LastName & IdBuilding & Comment & Other & EUSID & ")"
     
     
                Dim cmdFetchTeam As SqlCommand = New SqlCommand(strTeamQuery, sqlConn)
                sqlConn.Open()
                Dim dtrTeam As SqlDataReader
     
                dtrTeam = cmdFetchTeam.ExecuteReader
                'BTBooking_ModalPopupExtender.Show()
     
                'Response.Redirect("~/RequestOK.aspx")
     
            Else
     
     
            End If
     
     
        End Sub
    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
    Bonjour,

    J'ai finalement utiliser la fonction "SHOW" du modalpopupextender, tout simplement.

    Cordialement.

    DeWaRs

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

Discussions similaires

  1. [Débutant] Executer le code Javascript avant le code behind
    Par ahmedige dans le forum VB.NET
    Réponses: 0
    Dernier message: 27/06/2011, 14h54
  2. modifier code HTML avant affichage dans TWebBrowser
    Par iznogoud_23 dans le forum Composants VCL
    Réponses: 5
    Dernier message: 21/07/2010, 15h27
  3. Affichage Image avant execution code behind
    Par Mozofeuk dans le forum ASP.NET
    Réponses: 2
    Dernier message: 22/01/2010, 12h24
  4. Récupérer le code HTML avant affichage
    Par paf84 dans le forum ASP.NET
    Réponses: 7
    Dernier message: 14/09/2009, 16h09
  5. [C#] Execution d'une fonction en code behind
    Par elendila dans le forum ASP.NET
    Réponses: 21
    Dernier message: 22/08/2005, 15h06

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