如何插入ajax工具确认按钮c#

时间:2012-03-29 20:33:40

标签: c# asp.net ajax

我是AJAX的新手当我进入网页时,它会出现错误 ``(C:\用户\宏基\桌面\ RSS_proje \ RSS_proje \ WebApplication2-5.2 \ ShareRss.aspx         var lblMsg = $ get('<%= lblMessage.ClientID%>');){“'ScriptManager'类型的控件'ScriptManager1'必须放在带有runat = server的表单标签内。”}

javascript side


HTML code[code:html]<asp:ScriptManager ID="ScriptManager1" runat="server">

   

  function onCancel() {
    var lblMsg = $get('<%=lblMessage.ClientID%>');
    lblMsg.innerHTML = "You clicked the <b>Cancel</b> button of AJAX confirm.";
}

  also, button side



   <asp:Button ID="Button1" runat="server" Text="Share RSS" BackColor="#FF6600" 
            BorderColor="#FF9933" BorderStyle="Solid" Font-Bold="True" ForeColor="White" 
            Width="78px" onclick="Button1_Click" />
            <ajaxToolkit:ConfirmButtonExtender ID="cbe" runat="server"
TargetControlID="Button1"
ConfirmText="Are you sure you want to share this?"
OnClientCancel="CancelClick" />
 <asp:Label ID="lblMessage" runat="server"></asp:Label><br />

C#SIDE

                 protected void Button1_Click(object sender, EventArgs e)
    {
        lblMessage.Text = "You clicked the <b>OK</b> button of AJAX confirm";
     }

1 个答案:

答案 0 :(得分:0)

如果ScriptManager标记的格式与您发布的完全一致,请确保为其提供适当的结束标记。如果你已经可以发布更多的标记,那么我们可以更好地了解你的Dom的结构