0
下面是代码,我的ASPX页面上显示的手风琴:停止引导手风琴从关闭的ASP:按钮单击
当点击手风琴内的项目,该面板将展开预期。该面板包含许多ASP控件(按钮等)。点击按钮后,代码隐藏成功执行。
但是,页面也刷新了,手风琴也关闭了。
任何人都可以告诉我如何阻止手风琴从单击按钮时关闭?
<div class="panel-group" id="accordion">
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="panel-title">
<a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#collapseOne">News</a>
</h4>
</div>
<div id="collapseTwo" class="panel-collapse collapse">
<div class="panel-body">
<!--Update News Section-->
<div class="col-md-12">
<div class="panel panel-default">
<div class="panel-heading">
<h3>Post Latest News</h3>
</div>
<div class="panel-body">
<div class="col-lg-12">
<textarea id="myTextarea" runat="server"></textarea>
</div>
<asp:Button Text="Save" OnClick="btnSaveNews_Click" ID="btnSaveNews" runat="server" />
</div>
</div>
</div>
</div>
</div>
</div>
</div>
这里是代码隐藏也:
protected void btnSaveNews_Click(object sender, EventArgs e)
{
String strConnString = System.Configuration.ConfigurationManager.ConnectionStrings["BallinoraDBConnectionString1"].ConnectionString;
SqlConnection con = new SqlConnection(strConnString);
//====== Getting connection string defined in the web.config file. Pointed to the database we want to use.
// SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["EmployeeConnection"].ConnectionString);
//======= Insert Query.
string cmdText = "INSERT INTO News (News_Content, News_Date) VALUES (@Content, @Date)";
//====== Providning information to SQL command object about which query to
//====== execute and from where to get database connection information.
SqlCommand cmd = new SqlCommand(cmdText, con);
//===== Adding parameters/Values.
cmd.Parameters.AddWithValue("@Content", myTextarea.Value);
cmd.Parameters.AddWithValue("@Date", DateTime.Now);
//===== To check current state of the connection object. If it is closed open the connection
//===== to execute the insert query.
if (con.State == ConnectionState.Closed)
{
con.Open();
}
//===== Execute Query.
cmd.ExecuteNonQuery();
//===== close the connection.
con.Close();
//===== Clear text from textboxes
// clearInputControls();
//===== Bind data to repeater.
// bindEmployeeDetailsToRepeater();
}