在我的ASP頁面中,我創建了一個按鈕,並在該按鈕的單擊事件中,我想顯示我的div標籤部分。實際上,Div部分包含一個文本框和兩個按鈕。當asp.net頁面中的按鈕點擊事件時div不顯示?
這是我的aspx頁面內容:
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
<style type="text/css">
#popup
{
display:none;
position: fixed;
width:250px;
height: 150px;
top: 50%;
left: 50%;
margin-left:-155px;
margin-top:-110px;
border:5px solid red;
background-color:#DEDFDE;
padding:30px;
z-index:102;
font-family:Verdana;
font-size:10pt;
-webkit-border-radius:20px;
-moz-border-radius:20px;
font-weight:bold;
}
#content
{
height:auto;
width:250px;
margin:60px auto;
}
#popupclose
{
margin:35px 0 0 80px;
width:50px;
}
</style>
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<script type="text/javascript" language="javascript">
function ShowPopUp()
{
$('#popup').show("slow");
}
function hidePopUp()
{
$('#popup').hide("slow");
}
</script>
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Test">
</asp:Button>
<div id="popup">
<div id="content">
<input type="text"/><input type="button" value="Browse"/>
<input id="popupclose" type="button" value="Close" onclick="hidePopUp();/>
</div>
</div>
</asp:Content>
和我的C#代碼如下:
protected void Test(object sender,EventArgs e)
{
ClientScript.RegisterStartupScript(GetType(), "popup", "ShowPopUp()", true);
}
但每當我按一下按鈕,在div部分沒有顯示出來......我不知道什麼是這裏的問題...
請指引我走出這個問題...
是您的測試()方法調用? – Talha
是的...這是我的C#函數 – Saravanan