1

我正在使用带有 AjaxControlToolkit 的 Visual Studio 2005 我有一个带有 ModalPopupExtender 的 aspx 页面。我有两个 DropDownList,当用户从第一个 DropDownList 中选择值时,第二次加载并且用户可以从第二个 DropDownList 中选择值。The thing is, that when second value is selected, I have to load the content of a RadEditor (from oracle 11g table) what i'm trying to do is to be able to keep the value, index of the second DropDownList, to load radEditor 内容,但每次实际页面时,modalPopUpupExtender 在 postBack 我都会丢失第二个 DropDownList 值。我尝试使用 WebService,然后能够加载 RadEditor 内容,我尝试了 CascadingDropDown 的 BehaviorID 属性,但我无法调用 webMethod 来加载 RadEditor 内容,我不知道如何获取第二个 DropDownList 的值。这是我的 aspx 代码:

<ajaxToolkit:ModalPopupExtender ID="mpeLstCandidat" runat="server" TargetControlID="btnLstCandidat"
                PopupControlID="pnlLstCandidat" BackgroundCssClass="modalBackground" DropShadow="True"
                CancelControlID="ibFermerpnlLstCandidat" Enabled="True" DynamicServicePath="" />
            <asp:Button ID="btnAssignerLettre" runat="server" Style="display: none" meta:resourcekey="Button8Resource1" />
            <ajaxToolkit:ModalPopupExtender ID="mpeAssignerModeleLettre" BehaviorID="mpeLettreBehavior"
                runat="server" TargetControlID="btnAssignerLettre" PopupControlID="plnAssignerLettre"
                BackgroundCssClass="modalBackground" DropShadow="True" PopupDragHandleControlID="pnlDrag"
                DynamicServicePath="" Enabled="True" />
            <asp:Panel ID="plnAssignerLettre" runat="server" Style="display: none" CssClass="modalPopup"
                Width="900px" EnableViewState="false">
                <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always">
                    <ContentTemplate>
                        <ajaxToolkit:TabContainer ID="TC_LettreCand" runat="server" ActiveTabIndex="0">
                            <ajaxToolkit:TabPanel ID="TP_ListeLettreCand" runat="server" HeaderText="TP_TableReference">
                                <HeaderTemplate>
                                    Liste&nbsp;
                                </HeaderTemplate>
                            </ajaxToolkit:TabPanel>
                            <ajaxToolkit:TabPanel ID="TP_Formulaire" runat="server" HeaderText="TP_LettreCand">
                                <HeaderTemplate>
                                    Formulaire&nbsp;
                                </HeaderTemplate>
                                <ContentTemplate>
                                    <asp:FormView ID="fvLettreCand" runat="server" Width="100%" HorizontalAlign="Justify"
                                        AllowPaging="True" DataKeyNames="ModeleLettreID" CssClass="SkinCJM" meta:resourcekey="fvTraitementResource1">
                                        <InsertItemTemplate>
                                            <table border="0" cellpadding="0" cellspacing="0" style="width: 100%">                                                   <%--------------------------CascadingDropDow Liste utilisant des WebServices--%>
                                                    <td align="left" style="width: 20%" class="css_detailViewHeaderStyle">
                                                        <asp:Label ID="Label13" runat="server" SkinID="skin_lblform" Text="Type :"></asp:Label>
                                                    </td>
                                                    <td align="left" style="width: 80%" class="css_detailViewHeaderStyle">
                                                        <asp:DropDownList ID="ddl_TypeLettreListe" runat="server" />
                                                        <ajaxToolkit:CascadingDropDown ID="ccd1_Type" runat="server" ServicePath="ModeleLettre_WebService.asmx"
                                                            ServiceMethod="ChercherTypesLettre" TargetControlID="ddl_TypeLettreListe" Category="Type"
                                                            PromptText="--Choisir type--" />
                                                    </td>
                                                </tr>
                                                <tr>
                                                    <td align="left" style="width: 20%" class="css_detailViewHeaderStyle">
                                                        <asp:Label ID="Label14" runat="server" SkinID="skin_lblform" Text="Modele :"></asp:Label>
                                                    </td>
                                                    <td align="left" style="width: 80%" class="css_detailViewHeaderStyle">
                                                        <asp:UpdatePanel ID="tt" runat="server">
                                                            <ContentTemplate>
                                                                <asp:DropDownList ID="ddl_modLettreListe" runat="server" Enabled="false" OnDataBinding="onDatabinding_Modlettre"
                                                                    AutoPostBack="true">
                                                                </asp:DropDownList>
                                                                <ajaxToolkit:CascadingDropDown ID="CascadingDropDown1" runat="server" ServicePath="ModeleLettre_WebService.asmx"
                                                                    ServiceMethod="GetModForType" TargetControlID="ddl_modLettreListe" ParentControlID="ddl_TypeLettreListe"
                                                                    Category="Modele" PromptText="--Choisir modèle--" UseContextKey="true" LoadingText="...chargement"
                                                                    BehaviorID="BehIDAssignerLettre" />
                                                            </ContentTemplate>
                                                        </asp:UpdatePanel>

                                                        <script type="text/javascript">

                                                                 function pageLoad(sender, args){
                                                                   if($get("ctl00_ContentPlaceHolder1_plnAssignerLettre") != null ){
                                                                    var sel = $get("ctl00_ContentPlaceHolder1_TC_LettreCand_TP_Formulaire_fvLettreCand_ddl_modLettreListe");
                                                                    var sv = sel.options[sel.selectedIndex].value;
                                                                    var test = "test"
                                                                    alert(sv);
                                                                    if ($get("ctl00_ContentPlaceHolder1_TC_LettreCand_TP_Formulaire_fvLettreCand_ddl_modLettreListe") != null) {

                                                                           var Mycdd = $find("BehIDAssignerLettre");  
                                                                         alert("après l'appele de behavior");
                                                                         alert(sel);
                                                                         alert(sv);
                                                                         alert(document.getElementById('<%=  fvLettreCand.clientID %>'));

                                                                  } }
                                                                 }

                                                                 function onPopulated(sv, forme)  
                                                                 {  
                                                                   ModeleLettre_WebService.GetContenuLettre(sv, forme, OnComplete, OnError, OnTimeOut);
                                                                 } 

                                                                 function OnComplete(arg)
                                                                 {
                                                                    alert(arg);
                                                                 }

                                                                 function OnTimeOut(arg)
                                                                 {
                                                                    alert("timeOut has occured");
                                                                 }

                                                                 function OnError(arg)
                                                                 {
                                                                    alert("error has occured: " + arg._message);
                                                                 }
                                                        </script>

                                                    </td>
                                                </tr>
 <tr>
                                                    <td align="left" style="width: 12%" class="css_detailViewHeaderStyle" valign="top">
                                                        <asp:Label ID="LbContenu" runat="server" SkinID="skin_lblform" Text="Contenu :"></asp:Label></td>
                                                    <td align="left" style="width: 70%" class="css_detailViewHeaderStyle">
                                                        <telerik:RadEditor ID="reContenu" runat="server" EditModes="Design, Html" EnableTheming="True"
                                                            Width="100%" Language="fr-FR" Content='<%# Bind("Contenu") %>'>
                                                            <CssFiles>
                                                                <telerik:EditorCssFile Value="~/App_Themes/ThemeCJM/HTMLEditor.css" />
                                                            </CssFiles>
                                                            <Tools>
                                                                <telerik:EditorToolGroup>
                                                                    <telerik:EditorTool Name="Bold" />
                                                                    <telerik:EditorTool Name="Italic" />
                                                                    <telerik:EditorTool Name="Underline" />
                                                                    <telerik:EditorTool Name="ForeColor" />
                                                                    <telerik:EditorSeparator />
                                                                    <telerik:EditorTool Name="JustifyLeft" />
                                                                    <telerik:EditorTool Name="JustifyCenter" />
                                                                    <telerik:EditorTool Name="JustifyRight" />
                                                                    <telerik:EditorTool Name="JustifyFull" />
                                                                    <telerik:EditorTool Name="JustifyNone" />
                                                                    <telerik:EditorSeparator />
                                                                    <telerik:EditorTool Name="Indent" />
                                                                    <telerik:EditorTool Name="Outdent" />
                                                                </telerik:EditorToolGroup>
                                                                <telerik:EditorToolGroup>
                                                                    <telerik:EditorTool Name="Undo" />
                                                                    <telerik:EditorTool Name="Redo" />
                                                                    <telerik:EditorTool Name="Copy" />
                                                                    <telerik:EditorTool Name="Cut" />
                                                                    <telerik:EditorTool Name="Paste" />
                                                                    <telerik:EditorTool Name="PasteFromWord" />
                                                                </telerik:EditorToolGroup>
                                                                <telerik:EditorToolGroup>
                                                                    <telerik:EditorTool Name="InsertLink" />
                                                                    <telerik:EditorTool Name="InsertImage" />
                                                                </telerik:EditorToolGroup>
                                                            </Tools>
                                                            <Content>
                                                            </Content>
                                                        </telerik:RadEditor>
                                                    </td>
                                                </tr>
4

0 回答 0