本文介绍了检查按钮上单击的文本框文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我在aspx页面中有输入类型的文本框.我想检查按钮上单击的文本是否为"text1",然后单击按钮上将打开其他页面.
请尽可能帮助我.
hi guys,
i have input type text box in a aspx page. i want to check on button click whether the text is "text1" then on button click other page will be open.
please help me as sson as possible.
推荐答案
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Button" />
在您的.aspx.cs页面中
In your .aspx.cs page
protected void Button1_Click(object sender, EventArgs e)
{
if (TextBox1.Text == "text1")
{
Response.Redirect(url);//here url is which page you need to open
}
else
{
TextBox1.Focus();
}
}
<FORM action="http://somesite.com/page.htm onsubmit="validateForm()" method="post">
On button click write bellow cod
Assume the textbox id is txtbox1
if(txtbox1.Text=="text1")
{
Response.Redirect("abc.aspx");
//Server.Transfer("xyz.aspx");
}
这篇关于检查按钮上单击的文本框文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!