contentplaceholder Web应用程序(asp.net4)中的按钮不会触发

时间:2015-06-05 15:58:27

标签: asp.net c#-4.0

我在asp.net Web应用程序中创建了一个母版页。在contentplaceholder中,我有一个按钮,但在渲染页面,然后单击按钮时,它不会触发。

我该怎么做?

非常感谢。

       <asp:Content ID="Content2"      ContentPlaceHolderID="ContentPlaceHolder1"runat="server" >   

<asp:Panel ID="Panel1"  runat="server" DefaultButton="Button1">        
    <asp:Button ID="Button1"  Text="register" ForeColor="Blue" Font-Bold="true"  Font-Names="tahoma" Font-Size="Medium" Height="40px" runat="server" onclick="Button1_Click"/>
</asp:Panel>

    

default.aspx.designer.cs

protected global::System.Web.UI.WebControls.Button Button1;

的button1_Click:

protected void Button1_Click(object sender, EventArgs e) 
{ 
    Page page = HttpContext.Current.Handler as Page; 
    Boolean re = SDKClass.News_InsertNew(
        Subject_News_textbox.Text.ToString(),
        Brief_News_textbox.Text.ToString(), 
        CKEditor1.Text.ToString(), 
        date_now_textbox.Text, 
        "Image1", 
        true); 
    if (re == true) 
    { 
        ScriptManager.RegisterStartupScript(page, page.GetType(), "message", "alert(' register news')", true); 
    } 
} 

0 个答案:

没有答案