当前位置:编程学习 > C#/ASP.NET >>

UpdatePanel里如何正确加载JS呢

我做的一个发表序评论的功能,内容用的是JS 加载的UBB,提交成功后repater里用的UpdatePanel局部刷新功能。现在的问题就是第一次进入页面时,UBB那些按钮能显示,但提交成功后它就不显示了,感觉是没有加载到调用UBB 的那段JS
还望大家帮我看看应该怎么用才完全正确呢,代码如下
HTTP CODE
<asp:scriptmanager id="ScriptManager1" runat="server"></asp:scriptmanager>
    <asp:updatepanel id="UpdatePanel1" runat="server" childrenastriggers="True">
    <ContentTemplate>
        <div id="pinglun">
            <asp:Repeater ID="rp_pinglun" runat="server">
                <ItemTemplate>
                    <ul  class="pinlu_sp" style='background-color:<%#(Container.ItemIndex%2==0)?"#FBFBFB":"#FFF"%>'>
                        <li class="pinlu_sp1">
                            <a href="ShowUser.aspx?id=<%#Eval("id") %>" title="<%#Eval("tName") %>">
                                <img src="<%# Eval("tPic")%>" width="100" height="120" /></a>
                        </li>
                        <li class="pinlu_sp2">
                            <a href="ShowUser.aspx?id=<%#Eval("id") %>" title="<%#Eval("tName") %>"><p class="wenzi"><%# Eval("tName").ToString()%></p></a>
                            <span class="huibai"><%# Eval("tYear")%>岁 <%# Eval("tProvince")%> <%# Eval("tCity")%><br />
                            愿寻找<%# Eval("qw_tAge1")%>~<%# Eval("qw_tAge2")%>岁的<%# Eval("tSex")%><br />诚信值:<span class="red"><%# Eval("tCoinValue")%></span><br /><%# ComFun.DateStringFromNow( Convert.ToDateTime(Eval("tTime").ToString()))%>登录过</span>
                                                
                        </li>
                        <li class="pinlu_sp3">
                            <div>评论:</div>
                            <div class="pinlu_lr"><%# ComFun.UbbToHtml(Eval("tContent").ToString())%></div>
                            <div><%# Eval("tTime") %></div></li>
                    </ul>    
                </ItemTemplate>
            </asp:Repeater>
            <webdiyer:aspnetpager id="AspNetPager1" runat="server" horizontalalign="right" onpagechanged="AspNetPager1_PageChanged"
        showcustominfosection="Left" width="95%" meta:resourcekey="AspNetPager1" custominfohtml="共有  <b><font color='red'>%RecordCount%</font></b>  条记录 当前页<b><font color='red'>%CurrentPageIndex%</font>/%PageCount%</b>   次序 %StartRecordIndex%-%EndRecordIndex%" alwaysshow="True" firstpagetext="首页" lastpagetext="尾页" nextpagetext="下一页" prevpagetext="上一页" pagesize="8"></webdiyer:aspnetpager>
        </div>
        <div id="pl">
            <ul class="show_user"><li style="width:58%;float:left"><a href="ShowPinglun.aspx" class="orangey" title="查看更多评论">网友评伦:<asp:Label ID="count_PL" runat="server"></asp:Label>条</a></li><li style="width:40%;float:left"><a class="tomsg" href="User_ToPF.aspx?userID=<%= userID %>&userName=<%= userName %>"  title='给<<%=userName %>>打分并评论'">寻情记好友评分:<span class="pf"><asp:Label ID="count_PF" runat="server"></asp:Label></span></a> <span class="huise">(<img src="images/pf_good.gif" alt="好评" />112;<img src="images/pf_bad.gif" alt="差评" />42)</span></li></ul>
            <ul style="padding:5px 0 0 20px">
                <li><asp:RadioButtonList ID="tPF" runat="server" RepeatDirection="Horizontal"
                            RepeatLayout="Flow">
                            <asp:ListItem Value="0.1"><img src="images/pf_good.gif" />好评</asp:ListItem>
                            <asp:ListItem Value="-0.1"><img src="images/pf_bad.gif" />差评</asp:ListItem>
                            <asp:ListItem Value="0">不评</asp:ListItem></asp:RadioButtonList> <b class="red">*</b></li>
                <li class="jiange"></li>
                <li style="width:100%"><div style="float:left;width:68%"><asp:TextBox ID="tcontent" runat="server" TextMode="MultiLine" Width="450px" Height="80px" CssClass="reg_txt_bs"></asp:TextBox></div>
                    <div style="float:left;width:30%;padding-top:90px;"><b class="red">*</b> <span class="huise">(限30-1500字)</span></div></li>
                <li style="padding:2px 0"><asp:Button ID="btnSend" runat="server" Text="提交发送" OnClick="btnSend_Click" OnClientClick="return pf_check();" /></li>
            </ul>
        </div>
        <script language="javascript" type="text/javascript" src="UbbEditor/js/AnUbbEditor-min.js"></script>
        <script language="javascript" type="text/javascript">
            _.load(function () {
                _f.setButtonPath("UbbEditor/editor_img").setUploadPath("UbbEditor/upload_img");
                var myeditor = new AnUBBEditor("tcontent", false);
            });
        </script>
        </ContentTemplate>
        </asp:updatepanel>


cs代码
protected void btnSend_Click(object sender, EventArgs e)
    {
        MyHelper myHelper = new MyHelper();
        try
        {
            string userID_F = "000000"; //写评论会员
            string userID_T = Request.QueryString["userID"];    //被评论会员
            if (Request.Cookies["MyLove_Cookies"] != null)
            {
                userID_F = MyCode.check_UserIsLogin();
            }
            float pf = float.Parse(this.tPF.SelectedValue);
            MyCode.PF_update_userinfo(pf, int.Parse(userID_T));
            string content = this.tcontent.Text.Replace("'", "''");

            DateTime dt = DateTime.Now;
            int tepID = MyCode.get_maxID(0, "QT_Pinglun");
            string str = "Insert into QT_Pinglun(ID,userID_F,userID_T,tPF,tContent,tTime) values(" + tepID + ",'" + userID_F + "','" + userID_T + "'," + pf + ",'" + content + "','" + dt + "')";
            myHelper.ExecuteNonQuery(str);
            ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "消息框", "<script>alert('评论打分提交成功!\\n\\n谢谢您对该会员的支持!');ubbLoad();</script>", false);
            //局部不刷新
            pageLoad();
        }
        finally
        {
            myHelper.CloseConnection();
        }
    } --------------------编程问答--------------------

 <asp:ScriptManager ID="ScriptManager1" runat="server">
     <Scripts>
            <asp:ScriptReference Path="js's path" />
     </Scripts>
    </asp:ScriptManager>
--------------------编程问答--------------------
引用 1 楼 chen_ya_ping 的回复:
HTML code

 <asp:ScriptManager ID="ScriptManager1" runat="server">
     <Scripts>
            <asp:ScriptReference Path="js's path" />
     </Scripts>
    </asp:ScriptMana……


还是一样的哦
--------------------编程问答-------------------- 还在等待中,这个问题困扰我N久了,帮帮忙吧,分不够可以再加的 --------------------编程问答--------------------

ScriptManager.RegisterClientScriptInclude(_updatePanel, _updatePanel.GetType(), "XXX", "xxx.js");


JS文件末尾加if (typeof (Sys) != "undefined") { Sys.Application.notifyScriptLoaded();}
补充:.NET技术 ,  ASP.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,