1

我正在创建一个带有保存按钮的 aspx 页面。单击保存按钮时,我收到错误消息"Microsoft JScript runtime error: Sys.InvalidOperationException: Could not find UpdatePanel with ID 'lblAFTimePanel'。如果它是动态更新的,那么它必须在另一个UpdatePanel中。”

请在 aspx 页面下方找到。我有标签lblAFTime,它显示Radtime 选择器“RCFromTime”的错误消息,它又位于更新面板内。我使用RadAjaxmanager作为保存按钮。请帮助我。

    <body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager ID="RadScriptManager1" runat="server">
    </telerik:RadScriptManager> 

     <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="BirthDate">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="lbldob" />
                    <telerik:AjaxUpdatedControl ControlID="RTYear" />
                    <telerik:AjaxUpdatedControl ControlID="RTMonths" />
                    <telerik:AjaxUpdatedControl ControlID="RTDays" />
                    <telerik:AjaxUpdatedControl ControlID="lblAge" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RTYear">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="BirthDate" />
                    <telerik:AjaxUpdatedControl ControlID="lbldob" />

                    <telerik:AjaxUpdatedControl ControlID="lblAge" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="rbSave">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="rbSave" />
                    <telerik:AjaxUpdatedControl ControlID="Message" />

                    <telerik:AjaxUpdatedControl ControlID="lblRegnumber" />
                    <telerik:AjaxUpdatedControl ControlID="LblRegnNo" />
                    <telerik:AjaxUpdatedControl ControlID="lbltitle" />
                    <telerik:AjaxUpdatedControl ControlID="lblname" />
                    <telerik:AjaxUpdatedControl ControlID="lbldob" />
                    <telerik:AjaxUpdatedControl ControlID="lblAge" />
                    <telerik:AjaxUpdatedControl ControlID="lblfile" />
                    <telerik:AjaxUpdatedControl ControlID="lblnation" />
                    <telerik:AjaxUpdatedControl ControlID="lblmobile" />
                    <telerik:AjaxUpdatedControl ControlID="lblAFTime" />
                    <telerik:AjaxUpdatedControl ControlID="lblATTime" />
                    <telerik:AjaxUpdatedControl ControlID="lblTimeComp" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>    



    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">

            <script type="text/javascript">             
             function checkError(sender, args) {

                    var dt = args._newValue;
                    var label = $get('<%= lbldob.ClientID %>');
                    if (isNaN(Date.parse(dt))) {
                        args.set_cancel(true);
                        label.innerHTML = "Invalid date";                        
                    }
                    else {
                        label.innerHTML = "";
                    }

                }       
            </script>

        </telerik:RadCodeBlock>    
    <telerik:RadFormDecorator ID="FormDecorator1" runat="server" DecoratedControls="all"></telerik:RadFormDecorator>
    <telerik:RadWindowManager ID="RadWindowManager1" runat="server">
        <Windows>
            <telerik:RadWindow ID="NationalityDialog" Title="Nationality Data" runat="server" Behaviors="Close" Height="550px" Width="450px"
                Left="150px" />
            <telerik:RadWindow ID="RefDrdialog" Title="Referral Doctor Data" runat="server" Height="600px" Width="800px"
                Left="200px" Behaviors="Close" />
            <telerik:RadWindow ID="RefNewPatdialog" Title="New Patient Enquiry" runat="server" Height="550px" Width="1200px"
                Left="200px" Behaviors="Close" Modal="true" />


        </Windows>
    </telerik:RadWindowManager>

  <table border="1" width="100%">
  <tr>
  <td>  
         //some codes
        <table border="0" cellpadding="5" >   
             <tr>

            <br />        
        <table id="TblDoctorApp" runat="server" border="0" cellpadding="5">  
            <tr>
            <td colspan="3" style="font-family: Tahoma; font-size: small; font-weight: bold; font-style: normal; font-variant: normal">
                Appointment with Doctor
            </td>
            </tr>             
            <tr>
            <td>
                Clinic
            </td>
            <td>
                <telerik:RadComboBox ID="RCClinic" runat="server" Width="150px" 
                    DropDownWidth="500px" Height="200px" EmptyMessage="Select Clinic" EnableLoadOnDemand="true"
                 Filter="StartsWith" OnItemsRequested="RCClinic_ItemsRequested" 
                    HighlightTemplatedItems="true" 
                    OnSelectedIndexChanged="RCClinic_SelectedIndexChanged" AutoPostBack="true" 
                    >                  

                 <HeaderTemplate>
                  <table style="width: 500px" cellspacing="0" cellpadding="0">
                        <tr>
                        <td style="text-align:left;width:250px">Clinic
                        </td>
                        <td style="text-align:left;width:250px">Doctor
                        </td>
                        </tr>                
                </table>
                </HeaderTemplate>
                <ItemTemplate>
                <table  style="width: 500px" cellspacing="0" cellpadding="0">
                    <tr>
                    <td style="text-align:left;width:250px">
                        <%# DataBinder.Eval(Container, "Text")%>
                    </td>
                    <td style="text-align:left;width:250px">
                        <%# DataBinder.Eval(Container, "Attributes['doc_name']")%>
                    </td>
                    </tr>
                </table>
                </ItemTemplate>              
                 </telerik:RadComboBox>
            </td>
            </tr>
            <tr>
            <td>
                Doctor
            </td>      
            <td>
                <asp:UpdatePanel ID="PanelDr" runat="server" UpdateMode="Conditional">
                         <Triggers>
                           <asp:AsyncPostBackTrigger ControlID="RCClinic" />
                         </Triggers>
                         <ContentTemplate>
                         <telerik:RadTextBox ID="RCDoctor" runat="server" Width="150px" ></telerik:RadTextBox>
                         </ContentTemplate>
                         </asp:UpdatePanel>               

            </td>
                <td>
                   <asp:UpdatePanel ID="PanelDur" runat="server" UpdateMode="Always">
                         <Triggers>
                           <asp:AsyncPostBackTrigger ControlID="RCClinic" />
                         </Triggers>
                         <ContentTemplate>
                <asp:DropDownList ID="RCDuration" runat="server" Width="75px" AutoPostBack="true" OnSelectedIndexChanged="RCDuration_SelectedIndexChanged" >
                        <asp:ListItem Text="Select" Value="0" />
                        <asp:ListItem runat="server" Text="5 Min" Value="5" />
                        <asp:ListItem runat="server" Text="10 Min" Value="10" />
                        <asp:ListItem runat="server" Text="15 Min" Value="15" />
                        <asp:ListItem runat="server" Text="20 Min" Value="20" />
                        <asp:ListItem runat="server" Text="25 Min" Value="25" />
                        <asp:ListItem runat="server" Text="30 Min" Value="30" />
                        <asp:ListItem runat="server" Text="35 Min" Value="35" />
                        <asp:ListItem runat="server" Text="40 Min" Value="40" />
                        <asp:ListItem runat="server" Text="45 Min" Value="45" />
                        <asp:ListItem runat="server" Text="50 Min" Value="50" />
                        <asp:ListItem runat="server" Text="55 Min" Value="55" />
                        <asp:ListItem runat="server" Text="60 Min" Value="60" />
                    </asp:DropDownList>   
                 </ContentTemplate>
                </asp:UpdatePanel> 
            </td>
            </tr>
            <tr>
            <td>
            </td>
            <td>
                From
            </td>
            <td>
                To
            </td>
            </tr>
            <tr>
            <td>
                App.Time
            </td>
            <td>
                <asp:UpdatePanel ID="UpdatePanel6" runat="server" UpdateMode="Always">
                    <Triggers>
                    <asp:AsyncPostBackTrigger ControlID="RCDuration" />
                    </Triggers>
                    <ContentTemplate>
                <telerik:RadTimePicker ID="RCFromTime" runat="server" Width="110px" Culture="en-US" 
                            TimeView-TimeFormat="t" DateInput-DateFormat="h:mm tt" 
                            DateInput-DisplayDateFormat="h:mm tt" Skin="Web20" >
                     <TimeView ID="TimeView1" StartTime="08:00:00" EndTime="20:00:00" Height="100px" Width="250px" ShowHeader="False" runat="server"></TimeView>
                                </telerik:RadTimePicker>                          
                 </ContentTemplate>
                </asp:UpdatePanel> 

            </td>
            <td>
            <asp:UpdatePanel ID="UpdatePanel7" runat="server" UpdateMode="Always">
            <Triggers>
            <asp:AsyncPostBackTrigger ControlID="RCDuration" />
            </Triggers>
            <ContentTemplate>
              <telerik:RadTimePicker ID="RCToTime" runat="server" Width="110px" Culture="en-US" 
                    TimeView-TimeFormat="t" DateInput-DateFormat="h:mm tt" 
                    DateInput-DisplayDateFormat="h:mm tt" Skin="Web20">
                    <TimeView ID="TimeView2" StartTime="08:00:00" EndTime="20:00:00" Height="100px" Width="250px" ShowHeader="False" runat="server"></TimeView>
                                </telerik:RadTimePicker>               
             </ContentTemplate>
              </asp:UpdatePanel>  
            </td>           
            </tr>
             <tr>
            <td></td>
            <td>  
                <asp:UpdatePanel ID="Panelftime" runat="server" UpdateMode="Always">
            <Triggers>
            <asp:AsyncPostBackTrigger ControlID="RCFromTime" />
            </Triggers>
            <ContentTemplate>     
                <asp:Label ID="lblAFTime" runat="server" Text="" ForeColor="Red"></asp:Label>   
             </ContentTemplate>
              </asp:UpdatePanel>      
            </td>
            <td>   

                <asp:Label ID="lblATTime" runat="server" Text="" ForeColor="Red"></asp:Label>

            </td>

            </tr>  
            <tr>
            <td></td>
            <td colspan="2">
                <asp:Label ID="lblTimeComp" runat="server" Text="" ForeColor="Red"></asp:Label>                
            </td>
            </tr>             
        </table>  

            <br />    
        <table border="0" cellpadding="5">     
        <tr>
        <td style="font-family: Tahoma; font-size: small; font-weight: bold; font-style: normal; font-variant: normal">
            Kin Details
        </td>
        </tr>          
            <tr>
                <td>
                Name
                </td>
                <td>    
                    <telerik:RadTextBox  ID="RTKinName" runat="server" Width="150px"   ></telerik:RadTextBox>
                </td>
            </tr>
            <tr>
            <td>
                Relation
            </td>
            <td>
                <telerik:RadComboBox ID="RCKinRel"  
                runat="server" 
                Width="150px"  /> 
            </td>
            <td>
            Phone
            </td>
            <td>
                <telerik:RadMaskedTextBox ID="RTKinPhone" runat="server" Mask="(###)-#######" 
                    Width="75px" >
                </telerik:RadMaskedTextBox>


            </td>
            </tr>
            </table> 


    </td>
  </tr>
  </table>

    <div>
    <table>
    <tr>
    <td class="style8"> 

        <telerik:RadButton ID="RbSave" runat="server" Text="Save" 
            onclick="RbSave_Click" >
                            <Icon PrimaryIconCssClass="rbSave" PrimaryIconLeft="4" PrimaryIconTop="4" />
                        </telerik:RadButton>
                    </td>
                    <td>
        <telerik:RadButton ID="RbClose" runat="server" Text="Close" 
            onclick="RbClose_Click" style="top: 0px; left: 0px"  >
                            <Icon PrimaryIconCssClass="rbCancel" PrimaryIconLeft="4" PrimaryIconTop="4" />
                        </telerik:RadButton>
    </td>
    </tr>
    </table>  
    </div>



    </form>
</body>
4

1 回答 1

1

只需删除此行:<telerik:AjaxUpdatedControl ControlID="lblAFTime" />您不需要它,因为 Panelftime UpdatePanel 具有AlwaysUpdateMode 属性值。

于 2012-07-31T08:47:46.590 回答