jquery的时间UI出问题了貌似是ajax控件导致的 我用的是asp.net自身提供的无刷新控件,当我没点击btnsumbmit这个提交按钮的时候,txtsummarygo,txtsummaryover,txtplango,txtpalanover都能够触发弹出一个日历选择,但是我点击btnsumbmit完毕数据添加之后,要是想再添加一条信息的话,鼠标点几那4个文本框就不会弹出日历选择了,这是怎么回事呢?
代码如下<asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
    
                <script>
                    $(function () {
                        $("#txtsummarygo").datepicker();
                        $("#txtsummaryover").datepicker();
                        $("#txtplango").datepicker();
                        $("#txtpalanover").datepicker();
                    });
            </script>
    
    <div style="width:100%; height:200px; float:left;">
    <div style="width:25%; height:30px; text-align:right; line-height:30px; float:left;">总结开始日时间:</div>
    <div style="width:25%; height:30px; float:left;"><asp:TextBox ID="txtsummarygo" style="width:95%; margin-top:4px; border:solid #6293bb 1px;" runat="server"></asp:TextBox></div>
    <div style="width:25%; height:30px; text-align:right; line-height:30px; float:left;">总结开始日时间:</div>
    <div style="width:25%; height:30px; float:left;"><asp:TextBox ID="txtsummaryover" style="width:95%; margin-top:4px; border:solid #6293bb 1px;" runat="server"></asp:TextBox></div>
    <div align="center" style="width:100%; height:160px; float:left;"><asp:TextBox ID="txtsummaryinfo" TextMode="MultiLine" MaxLength="300" style="width:95%; height:150px;" runat="server"></asp:TextBox></div>
    </div>
    
    <div style="width:100%; height:250px; margin-top:20px; float:left;">
    <div style="width:25%; height:30px; text-align:right; line-height:30px; float:left;">计划开始日时间:</div>
    <div style="width:25%; height:30px; float:left;"><asp:TextBox ID="txtplango" style="width:95%; margin-top:4px; border:solid #6293bb 1px;" runat="server"></asp:TextBox></div>
    <div style="width:25%; height:30px; text-align:right; line-height:30px; float:left;">计划结束日时间:</div>
    <div style="width:25%; height:30px; float:left;"><asp:TextBox ID="txtpalanover" style="width:95%; margin-top:4px; border:solid #6293bb 1px;" runat="server"></asp:TextBox></div>
    <div align="center"style="width:100%; height:160px; float:left;"><asp:TextBox ID="txtplaninfo" TextMode="MultiLine" MaxLength="300" style="width:95%; height:150px;" runat="server"></asp:TextBox></div>
    <div style="width:100%; height:30px; float:left; text-align:center;">
        <asp:ImageButton ID="btnsumbmit" ImageUrl="../images/submit.gif" runat="server" style="width:74px; height:25px;" onclick="btnsumbmit_Click" /></div>
    <div align="center" style="width:100%; height:20px; float:left; text-align:center;">
    
        <div ID="p1" runat="server"  style="display:none">
           
           <div class="timgdiv"><img alt="成功" style="border:0px;" src="../images/ok.gif" /></div>
   <div style="float:left; width:60px; height:14px; margin-top:2px; line-height:14px; color:Green; cursor:pointer;">添加成功!</div>
           
        </div>
        <div ID="p2" runat="server"  style="display:none">
           
           <div class="timgdiv"><img alt="错误" style="border:0px;" src="../images/err.gif" /></div>
   <div style="float:left; width:150px; height:14px; margin-top:2px; line-height:14px; color:#ef4444; cursor:pointer;">提交失败,请认真填写完毕。</div>
           
        </div>
        
    </div>
    </div>
    </ContentTemplate>
        <Triggers>
        <asp:AsyncPostBackTrigger ControlID="btnsumbmit" EventName="Click" />
        </Triggers>
        </asp:UpdatePanel>

解决方案 »

  1.   

    又是asp控件....哥笑而不语
      

  2.   


    我用jquery的ajax貌似会出错
      

  3.   

    不是jquery的ajax的错,
    js和jquery都是操作html标签对象的,
    用来操作服务端对象就要特别注意服务端对象的ID解析成HTML标签后的变化,
    同时还要注意JS的运行环境有没有变化
      

  4.   

    var sgo;
    如果sgo接收过来的变量值是 &names  含有&这个字符就出错了 $.ajax({           
             type: "POST",                 
             url: "ajax/summary.ashx",                  
             data: 'sgo='+sgo如果用jquery的ajax来把注册信息提交到summary.ashx  就会出错了,因为含有&这个符号,
      

  5.   

    包含了JQUERY的关键字,当然出错,
    这放任何语言里都会出错的,
    你不会预处理下啊....
      

  6.   

    &在浏览器里经常不能正常解析,
    你可以用&amp;来代替
      

  7.   

    要不你别用UpdatePanel
    要不你就把
    <script>
                        $(function () {
                            $("#txtsummarygo").datepicker();
                            $("#txtsummaryover").datepicker();
                            $("#txtplango").datepicker();
                            $("#txtpalanover").datepicker();
                        });
                    </script>
    这段东西的
                        $(function () {});
    去掉,接着把这四句话放到最后,如:<asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>    
        <div style="width:100%; height:200px; float:left;">
        <div style="width:25%; height:30px; text-align:right; line-height:30px; float:left;">总结开始日时间:</div>
        <div style="width:25%; height:30px; float:left;"><asp:TextBox ID="txtsummarygo" style="width:95%; margin-top:4px; border:solid #6293bb 1px;" runat="server"></asp:TextBox></div>
        <div style="width:25%; height:30px; text-align:right; line-height:30px; float:left;">总结开始日时间:</div>
        <div style="width:25%; height:30px; float:left;"><asp:TextBox ID="txtsummaryover" style="width:95%; margin-top:4px; border:solid #6293bb 1px;" runat="server"></asp:TextBox></div>
        <div align="center" style="width:100%; height:160px; float:left;"><asp:TextBox ID="txtsummaryinfo" TextMode="MultiLine" MaxLength="300" style="width:95%; height:150px;" runat="server"></asp:TextBox></div>
        </div>
        
        <div style="width:100%; height:250px; margin-top:20px; float:left;">
        <div style="width:25%; height:30px; text-align:right; line-height:30px; float:left;">计划开始日时间:</div>
        <div style="width:25%; height:30px; float:left;"><asp:TextBox ID="txtplango" style="width:95%; margin-top:4px; border:solid #6293bb 1px;" runat="server"></asp:TextBox></div>
        <div style="width:25%; height:30px; text-align:right; line-height:30px; float:left;">计划结束日时间:</div>
        <div style="width:25%; height:30px; float:left;"><asp:TextBox ID="txtpalanover" style="width:95%; margin-top:4px; border:solid #6293bb 1px;" runat="server"></asp:TextBox></div>
        <div align="center"style="width:100%; height:160px; float:left;"><asp:TextBox ID="txtplaninfo" TextMode="MultiLine" MaxLength="300" style="width:95%; height:150px;" runat="server"></asp:TextBox></div>
        <div style="width:100%; height:30px; float:left; text-align:center;">
            <asp:ImageButton ID="btnsumbmit" ImageUrl="../images/submit.gif" runat="server" style="width:74px; height:25px;" onclick="btnsumbmit_Click" /></div>
        <div align="center" style="width:100%; height:20px; float:left; text-align:center;">
        
            <div ID="p1" runat="server"  style="display:none">
               
               <div class="timgdiv"><img alt="成功" style="border:0px;" src="../images/ok.gif" /></div>
               <div style="float:left; width:60px; height:14px; margin-top:2px; line-height:14px; color:Green; cursor:pointer;">添加成功!</div>
               
            </div>
            <div ID="p2" runat="server"  style="display:none">
               
               <div class="timgdiv"><img alt="错误" style="border:0px;" src="../images/err.gif" /></div>
               <div style="float:left; width:150px; height:14px; margin-top:2px; line-height:14px; color:#ef4444; cursor:pointer;">提交失败,请认真填写完毕。</div>
               
            </div>
            
        </div>
        </div>
                    <script>
                            $("#txtsummarygo").datepicker();
                            $("#txtsummaryover").datepicker();
                            $("#txtplango").datepicker();
                            $("#txtpalanover").datepicker();
                    </script>
        </ContentTemplate>
            <Triggers>
            <asp:AsyncPostBackTrigger ControlID="btnsumbmit" EventName="Click" />
            </Triggers>
            </asp:UpdatePanel>
      

  8.   

    说错了,应该这样:<asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>    
        <div style="width:100%; height:200px; float:left;">
        <div style="width:25%; height:30px; text-align:right; line-height:30px; float:left;">总结开始日时间:</div>
        <div style="width:25%; height:30px; float:left;"><asp:TextBox ID="txtsummarygo" style="width:95%; margin-top:4px; border:solid #6293bb 1px;" runat="server"></asp:TextBox></div>
        <div style="width:25%; height:30px; text-align:right; line-height:30px; float:left;">总结开始日时间:</div>
        <div style="width:25%; height:30px; float:left;"><asp:TextBox ID="txtsummaryover" style="width:95%; margin-top:4px; border:solid #6293bb 1px;" runat="server"></asp:TextBox></div>
        <div align="center" style="width:100%; height:160px; float:left;"><asp:TextBox ID="txtsummaryinfo" TextMode="MultiLine" MaxLength="300" style="width:95%; height:150px;" runat="server"></asp:TextBox></div>
        </div>
        
        <div style="width:100%; height:250px; margin-top:20px; float:left;">
        <div style="width:25%; height:30px; text-align:right; line-height:30px; float:left;">计划开始日时间:</div>
        <div style="width:25%; height:30px; float:left;"><asp:TextBox ID="txtplango" style="width:95%; margin-top:4px; border:solid #6293bb 1px;" runat="server"></asp:TextBox></div>
        <div style="width:25%; height:30px; text-align:right; line-height:30px; float:left;">计划结束日时间:</div>
        <div style="width:25%; height:30px; float:left;"><asp:TextBox ID="txtpalanover" style="width:95%; margin-top:4px; border:solid #6293bb 1px;" runat="server"></asp:TextBox></div>
        <div align="center"style="width:100%; height:160px; float:left;"><asp:TextBox ID="txtplaninfo" TextMode="MultiLine" MaxLength="300" style="width:95%; height:150px;" runat="server"></asp:TextBox></div>
        <div style="width:100%; height:30px; float:left; text-align:center;">
            <asp:ImageButton ID="btnsumbmit" ImageUrl="../images/submit.gif" runat="server" style="width:74px; height:25px;" onclick="btnsumbmit_Click" /></div>
        <div align="center" style="width:100%; height:20px; float:left; text-align:center;">
        
            <div ID="p1" runat="server"  style="display:none">
               
               <div class="timgdiv"><img alt="成功" style="border:0px;" src="../images/ok.gif" /></div>
               <div style="float:left; width:60px; height:14px; margin-top:2px; line-height:14px; color:Green; cursor:pointer;">添加成功!</div>
               
            </div>
            <div ID="p2" runat="server"  style="display:none">
               
               <div class="timgdiv"><img alt="错误" style="border:0px;" src="../images/err.gif" /></div>
               <div style="float:left; width:150px; height:14px; margin-top:2px; line-height:14px; color:#ef4444; cursor:pointer;">提交失败,请认真填写完毕。</div>
               
            </div>
            
        </div>
        </div>
                    <script>
    function initDatepicker()
    {
                            $("#txtsummarygo").datepicker();
                            $("#txtsummaryover").datepicker();
                            $("#txtplango").datepicker();
                            $("#txtpalanover").datepicker();
    };
    $(document).ready(function() {
      initDatepicker();
    });
                    </script>
        </ContentTemplate>
            <Triggers>
            <asp:AsyncPostBackTrigger ControlID="btnsumbmit" EventName="Click" />
            </Triggers>
            </asp:UpdatePanel>后台代码,在btnsumbmit_Click事件最后加入ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "initDateControl", "initDatepicker();", true);