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 :

probleme de masterpage+ scriptmanager + updatepanel + javascript


Sujet :

ASP.NET

  1. #1
    Membre du Club
    Profil pro
    Inscrit en
    Janvier 2006
    Messages
    65
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2006
    Messages : 65
    Points : 44
    Points
    44
    Par défaut probleme de masterpage+ scriptmanager + updatepanel + javascript
    Bonjour,

    Le but est de faire un refresh de l'updatepanel quand on fait coche une checkbox sur le treeview, cela marchais avant que j'utilise une masterpage.

    Quand je compile mon website il me dit qu'il ne connait pas updatepanel et ScriptManagerProxy .

    Masterpage :
    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
     
    <%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
     
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     
    <html xmlns="http://www.w3.org/1999/xhtml" >
    <head runat="server">
    <link href="StyleSheet.css" rel="stylesheet" type="text/css" />
        <title>Request application</title>
     
     
    </head>
    <body>
        <form id="form1" runat="server">
        <asp:ScriptManager id="ScriptManager1" runat="server"></asp:ScriptManager>
        <div id="master_header">
            <div id="master_headertop">
                <asp:HyperLink ID="HomePageLink" runat="server" NavigateUrl="~/index.aspx" ToolTip="....">
                            <asp:Image runat="server" ID="HeaderImage" ImageUrl="~/images/headertop_img.jpg" AlternateText="...." />
                        </asp:HyperLink>
     
            </div>
            <div id="master_headerbottom">
                &nbsp;</div>
        </div>
     
     <div id="master_page">
            <div id="master_menu">
    		    <div class="sidebar">
    		        <div class="sidebarheader">Managers and Supervisors</div>
    		        <div class="sidebarcontent">
                        <ul>
                        <li><a href="request.aspx">Request applciation</a></li>
                        <li><a href="state.aspx">State</a></li>
                        </ul>		            
    		        </div>
    		    </div>
    		</div>
        <div id="master_content" style="width: 60%">
    			<div id="master_contentheader"></div>
    			<div id="master_contentplaceholder" style="height:auto ; width:100%">
                            <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server" >
     
                    </asp:ContentPlaceHolder>
                </div>
    			<div id="master_contentfooter">Copyright © .</div>
    		</div>
    		</div>
        </form>
    </body>
    </html>
    Content
    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
     
    <%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="~/request.aspx.cs" Inherits="request" %>
     
     
    <%@ Register Assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
        Namespace="System.Web.UI" TagPrefix="asp" %>
    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxtoolkit" %>
     
     
    <asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
     
        <asp:ScriptManagerProxy runat="server">
        <Scripts>
        <asp:ScriptReference path="script.js" />
        </Scripts>
        </asp:ScriptManagerProxy>
     
                <table style="height: 593px; text-align: center;">
                 <tr >
                    <td style="width: 171px; height: 34px; font-weight: bold; text-align: left;"></td>
                    <td style="width: 283px; height: 34px; font-weight: bold; vertical-align: top; text-align: left;">Last Name</td>
                    <td style="width: 277px; height: 34px; font-weight: bold; vertical-align: top; text-align: left;">First Name</td>
                 </tr>
                 <tr>
                    <td style="height: 8px; text-align: left; font-weight: bold; vertical-align: middle; width: 171px;">
                        Manager</td>
                    <td style="height: 8px; text-align: left; width: 277px; vertical-align: middle;">
                        <asp:TextBox ID="txt_man_lname" runat="server" ></asp:TextBox>&nbsp;
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" ValidationGroup="submit1" ControlToValidate="txt_man_lname" ErrorMessage="Case empty" SetFocusOnError="true"  runat="server"  />
                        &nbsp;&nbsp;
                        <ajaxtoolkit:AutoCompleteExtender  TargetControlID="txt_man_lname" runat="server" ID="AutoCompleteExtender1" 
             MinimumPrefixLength="1" ServicePath="AutoCompletion.asmx"
             CompletionSetCount="5" EnableCaching="true" Enabled="true" CompletionInterval="10"
              ServiceMethod="GetLast_NameCompletion" />
                    </td>
                    <td style="height: 8px; text-align: left; width: 277px; vertical-align: middle;"> 
                        <asp:TextBox ID="txt_man_fname" runat="server"></asp:TextBox>&nbsp;
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator2"  ValidationGroup="submit1" ControlToValidate="txt_man_fname" ErrorMessage="Case empty" SetFocusOnError="true"  runat="server" Width="80px"  />
                        <ajaxtoolkit:AutoCompleteExtender  TargetControlID="txt_man_fname" runat="server" ID="AutoCompleteExtender2" 
             MinimumPrefixLength="1" ServicePath="AutoCompletion.asmx"
             CompletionSetCount="5" EnableCaching="true" Enabled="true" CompletionInterval="10"
              ServiceMethod="GetFirst_NameCompletion" />
                     </td>
     
                 </tr>
                 <tr>
                    <td style="height: 8px; text-align: left; font-weight: bold; vertical-align: middle; width: 171px;">Employe</td>
                    <td style="height: 8px; text-align: left; width: 277px; vertical-align: middle;"> 
                        <asp:TextBox ID="txt_emp_lname" runat="server"></asp:TextBox>&nbsp;
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator3" ValidationGroup="submit1" ControlToValidate="txt_emp_lname" ErrorMessage="Case empty" SetFocusOnError="true"  runat="server"  />
                        &nbsp;
                        <ajaxtoolkit:AutoCompleteExtender  TargetControlID="txt_emp_lname" runat="server" ID="AutoCompleteExtender4" 
             MinimumPrefixLength="1" ServicePath="AutoCompletion.asmx"
             CompletionSetCount="5" EnableCaching="true" Enabled="true" CompletionInterval="10"
              ServiceMethod="GetLast_NameCompletion" />
                        </td>
                    <td style="height: 8px; text-align: left; width: 277px; vertical-align: middle;"> 
                        <asp:TextBox ID="txt_emp_fname" runat="server"></asp:TextBox>&nbsp;
                        <asp:RequiredFieldValidator ID="RequiredFieldValidator4" ValidationGroup="submit1" ControlToValidate="txt_emp_fname" ErrorMessage="Case empty" SetFocusOnError="true"  runat="server"  />
                        &nbsp;
                        <ajaxtoolkit:AutoCompleteExtender  TargetControlID="txt_emp_fname" runat="server" ID="AutoCompleteExtender3" 
             MinimumPrefixLength="1" ServicePath="AutoCompletion.asmx"
             CompletionSetCount="5" EnableCaching="true" Enabled="true" CompletionInterval="10"
              ServiceMethod="GetFirst_NameCompletion" />
                        </td>
                 </tr>
                    <tr>
                        <td style="height: 17px; text-align: left; width: 171px;">
                            &nbsp;</td>
                        <td style="height: 17px; text-align: left; width: 285px; font-weight: bold;">
                            &nbsp;Site : &nbsp; &nbsp;<asp:DropDownList ID="drop_site" runat="server" DataSourceID="name_site" DataTextField="NAME"
                                DataValueField="NAME" Width="178px" >
                            </asp:DropDownList><br />
                            <asp:SqlDataSource ID="name_site" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
                                ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand='SELECT "NAME", "SITE_ID" FROM "SITE"'>
                            </asp:SqlDataSource>
                            </td>
                        <td style="height: 17px; text-align: left; width: 277px; font-weight: bold;">
                            &nbsp;Departement : &nbsp;<asp:DropDownList ID="drop_dept" runat="server" DataSourceID="name_dept" DataTextField="DEPT_NAME"
                                DataValueField="DEPT_NAME" Width="255px">
                            </asp:DropDownList><asp:SqlDataSource ID="name_dept" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
                                ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>" SelectCommand='SELECT "DEPT_NAME", "DEPARTMENT_ID" FROM "DEPARTMENT"'>
                            </asp:SqlDataSource>
                        </td>
                    </tr>
                 <tr>
                     <td colspan="3">
     
                         <asp:Label ID="lab_work_def" runat="server" Text="...." Width="739px" Font-Bold="True" Font-Italic="True" Font-Names="Arial" Font-Size="Smaller" ForeColor="Black" Visible="False"></asp:Label>&nbsp;
                         <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
                                        <ContentTemplate>
    &nbsp;<asp:Label id="Label1" runat="server" Width="333px" ForeColor="Red" Font-Bold="True"></asp:Label> <TABLE style="TEXT-ALIGN: left" id="TABLE1" runat="server"><TBODY><TR><TD style="WIDTH: 120px; HEIGHT: 208px"><asp:TreeView id="Tree_app" runat="server" ForeColor="Black" EnableClientScript="False" ShowLines="True" OnTreeNodeCheckChanged="Tree_app_TreeNodeCheckChanged" Font-Names="Calibri" ShowCheckBoxes="All" ImageSet="Simple">
     
                                <ParentNodeStyle  Font-Bold="False"></ParentNodeStyle>
                                <HoverNodeStyle  ForeColor="Gray" Font-Underline="True"></HoverNodeStyle>
                                <SelectedNodeStyle HorizontalPadding="0px" ForeColor="Gray" VerticalPadding="0px" Font-Underline="True"></SelectedNodeStyle>
                                <NodeStyle NodeSpacing="0px" HorizontalPadding="0px" ForeColor="Black" VerticalPadding="0px" Font-Size="10pt" Font-Names="Calibri"></NodeStyle>
                                <LeafNodeStyle ForeColor="Black" />
                                </asp:TreeView> </TD><TD style="WIDTH: 121px; HEIGHT: 208px"><asp:TreeView id="Tree_app_opt" runat="server" ForeColor="Black" EnableClientScript="False" ShowLines="True" Font-Names="Calibri" ShowCheckBoxes="All" ImageSet="Simple" Visible="False">
                                <ParentNodeStyle Font-Bold="False"></ParentNodeStyle>
                                <HoverNodeStyle ForeColor="Gray" Font-Underline="True"></HoverNodeStyle>
                                <SelectedNodeStyle HorizontalPadding="0px" ForeColor="Gray" VerticalPadding="0px" Font-Underline="True"></SelectedNodeStyle>
                                <NodeStyle NodeSpacing="0px" HorizontalPadding="0px" ForeColor="Black" VerticalPadding="0px" Font-Size="10pt" Font-Names="Calibri"></NodeStyle>
                                <LeafNodeStyle ForeColor="Black" />
                                </asp:TreeView> </TD></TR></TBODY></TABLE>
    </ContentTemplate>
                                    </asp:UpdatePanel></td>
                 </tr>
                 <tr>
                    <td style="width: 171px">
     
     
                    <asp:Button ID="submit1" runat="server" Text="Submit" ValidationGroup="submit1" OnClick="check_form"/></td>
                 </tr>
                </table>
     
     
        </asp:Content>
    JS
    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
     
    function foo()
    {
      var targ = window.event.srcElement;
     //name="Tree_appn5CheckBox" id="Tree_appn5CheckBox"
     
        if (targ.tagName == "INPUT" && targ.type == "checkbox")
        {
        if (targ.title == "DOCUMENTUM" || targ.title == "APPROVER"|| 
            targ.title == "AUTHOR" || targ.title == "CONSULTING" || 
            targ.title == "SEFERIS" || targ.title == "APPROVAL MEETING MANAGER"|| 
            targ.title == "NOTEBOOK CONSULTING" || targ.title == "NOTEBOOK CREATOR"|| 
            targ.title == "NOTEBOOK APPROVER" || targ.title == "INFOCENTER" )
            __doPostBack('UpdatePanel1','');
        } 
    }

  2. #2
    Rédacteur
    Avatar de nico-pyright(c)
    Profil pro
    Inscrit en
    Octobre 2003
    Messages
    6 414
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2003
    Messages : 6 414
    Points : 16 075
    Points
    16 075
    Par défaut
    il ne le reconnait pas dans le code behind tu veux dire ?
    quelle ligne est impactée par ce changement ?
    Peut-etre que tu dois changer la facon d'accéder à ton controle

  3. #3
    Membre du Club
    Profil pro
    Inscrit en
    Janvier 2006
    Messages
    65
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2006
    Messages : 65
    Points : 44
    Points
    44
    Par défaut
    c'est bon j'ai trouver la solution. Le nom de l updatepanel change dans une masterpage.

    Dans ma content page j'ai rajouter ca:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
     
    <input type="hidden" id="ctrlPrefix" name="ctrlPrefix" value='<asp:Literal Runat="server" ID="ctrlPrefix"></asp:Literal>'/>
    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
     
    var prefix = "";
     
     
    //returns the container prefix as all controls have that on their ids
    function getCrtlPrefix()
    {
    var objCrtlPrefix = document.getElementById("ctrlPrefix");
     
           if (objCrtlPrefix)
                 prefix = objCrtlPrefix.value;  
    }
     
    function foo(e)
    {
        getCrtlPrefix();
     
        var  UpdatePanel = document.getElementById(prefix + "UpdatePanel1");
     
        if (window.event)//IE
            var targ = window.event.srcElement; 
        else //FIREFOX
             var targ = e.target; 
        if (targ.tagName == "INPUT" && targ.type == "checkbox")
            __doPostBack(UpdatePanel.id,'');
    }

Discussions similaires

  1. Probleme avec mes textbox en javascript
    Par WaZz dans le forum Général JavaScript
    Réponses: 1
    Dernier message: 24/02/2006, 09h37
  2. [SGBD] Probleme menu css /php / mysql / javascript
    Par vincedjs dans le forum Administration
    Réponses: 14
    Dernier message: 21/02/2006, 17h51
  3. probleme avec puces crées en javascript
    Par GTJuanpablo dans le forum Général JavaScript
    Réponses: 12
    Dernier message: 13/02/2006, 14h56
  4. probleme d'INSERT INTO et JavaScript
    Par Matlight dans le forum Langage SQL
    Réponses: 3
    Dernier message: 04/03/2004, 15h36
  5. Réponses: 2
    Dernier message: 08/08/2003, 17h30

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