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:
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">
</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:
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>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" ValidationGroup="submit1" ControlToValidate="txt_man_lname" ErrorMessage="Case empty" SetFocusOnError="true" runat="server" />
<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>
<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>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" ValidationGroup="submit1" ControlToValidate="txt_emp_lname" ErrorMessage="Case empty" SetFocusOnError="true" runat="server" />
<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>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" ValidationGroup="submit1" ControlToValidate="txt_emp_fname" ErrorMessage="Case empty" SetFocusOnError="true" runat="server" />
<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;">
</td>
<td style="height: 17px; text-align: left; width: 285px; font-weight: bold;">
Site : <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;">
Departement : <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>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<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:
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','');
}
} |