请问如何使用C#ASP.NET webform中的引导主题修复按钮单击事件 [英] Please how do I fix button click event using bootstrap theme in C# ASP.NET webform
问题描述
美好的一天大家好请我在我的asp.net项目中遇到按钮点击事件的挑战当我尝试在设计按钮时点击我的引导主题它不会带我到asp.net webform例如(默认.aspx.cs)而是它带我到default.aspx。所以我无法在不使用asp.net拖放按钮的情况下在按钮下编写代码。
我尝试了什么:
Good day everyone please i am having challenges to have a button click event in my asp.net project when ever i try to click on my bootstrap theme when designing button it does not take me to the asp.net webform eg(default.aspx.cs) instead it takes me to the default.aspx. so i am unable to write my code under the button without using the asp.net drag and drop button.
What I have tried:
<button ID="btnlogin" class="btn btn-primary btn-block btn-flat" type="submit" runat="server" oneserverclick="btnlogin_onClick" >Sign In</button>
</div>
此代码无效。我希望每当我点击按钮它就会产生这样的东西
this code is not working. i want whereby whenever i click on the button it makes something like this
protected void btnlogin_Click(object sender, EventArgs e)
{
我可以写这样的代码
where i can write code like this
protected void btnlogin_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["loginConnectionString1"].ToString());
con.Open();
string query = "select count (*) from log where username ='" + txtuser.Text + "' and password ='" + txtpass.Text + "' ";
SqlCommand cmd = new SqlCommand(query, con);
string output = cmd.ExecuteScalar().ToString();
用于注册和其他代码
for registration and other codes
推荐答案
如果你的按钮调用btnlogin_onClick ,那么代码不能被称为Unnamed1_Click。
选择一个名字。
If your "button" calls "btnlogin_onClick", then the code cannot be called "Unnamed1_Click".
Pick one name.
这篇关于请问如何使用C#ASP.NET webform中的引导主题修复按钮单击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!