查库?
ajax-UpdatePanel
textchange写代码
ajax-UpdatePanel
textchange写代码
解决方案 »
- 怎样获取数据库报出的错误信息?
- 一年工作经验,北京做asp.net开发的,工资多少?
- 高分求助!IE小页面关闭问题
- 客户延期验收软件,我们怎么办?
- 国外访问国内网站问题?
- 好消息,腾讯7周年活动,现在开放六位数的QQ免费申请,你快去申请一个呀!晚了可没靓号了。
- -------------大家来看看这个怪问题。。。。。
- net(c#)开发之你见
- B/S中Excel数据导入到数据库的验证问题?
- ------关于DataGrid的问题-----
- 急!急!!急!!!求解如何在WebService中使用Session或Cookie---WebService安全策略
- JavaScript document.form1.prov.options 为空或不为对象
<asp:textbox id="TextBox2" ontextchanged="TextBox_TextChanged" ...protected void TextBox1_TextChanged(object sender,
{
TextBox txt = sender as Textbox;
if(txt.ID == "TextBox1") {
// 访问数据库
// txt.Text
// TextBox3.Text = <<newValueFormDb>>
}
else if(txt.ID == "TextBox2") {
// ...
}
}
this.textBox2.TextChanged += new System.EventHandler(this.textBox2_TextChanged);private void textBox2_TextChanged(object sender, EventArgs e)
{
this.textBox3.Text = this.textBox1.Text.Trim() + this.textBox2.Text.Trim();
}
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:TextBox ID="TextBox1" runat="server" OnTextChanged="TextBox1_TextChanged"></asp:TextBox>
<asp:TextBox ID="TextBox2" runat="server" OnTextChanged="TextBox2_TextChanged"></asp:TextBox>
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;public partial class Test : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{ }
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
this.TextBox3.Text = "从数据库取值";
}
protected void TextBox2_TextChanged(object sender, EventArgs e)
{
this.TextBox3.Text = "从数据库取值";
}
}
如果想不刷新的话,简单一点可以放置一个ajax:UpdatePanel 在页面上请问风暴虫,怎么实现?给点代码可以吗?呵呵
TEXTBOX1和TEXTBOX2分别对this.textBox2.TextChanged 添加各自的方法,
方法作用是判断如果TEXTBOX1和TEXTBOX2有且仅有一个不空,那么TEXTBOX3的内容重新赋值(值是来自不空的那个)。
如果TEXTBOX1和TEXTBOX2均不空则从数据库获得,
下面是我用vs.net2005 做的win应用程序代码片段web的雷同,仅供参考。
this.textBox2.TextChanged += new System.EventHandler(TextChanged);
this.textBox1.TextChanged += new System.EventHandler(TextChanged);
private void TextChanged(object sender, EventArgs e)//两个事件均加入这个方法
{
if (this.textBox2.Text != "" && this.textBox1.Text != "")
{
this.textBox3.Text = "从数据库得到数据";//连接数据库得到数据填入3中
}
else if (this.textBox2.Text == "" && this.textBox1.Text == "")
{
//do nothing
}
else
{
if (this.textBox2.Text != "")//如果1和2原来都有数据,那么这时你改变2让2变空因此
//这时3的数据应该是1的不是2的
{
this.textBox3.Text = textBox2.Text;
}
else
{
this.textBox3.Text = textBox1.Text;
}
}
}
{
if(textbox1.Text == "")//textbox1值为空
{
if(textbox2.Text == "")//textbox2值为空
{
//下面自已写吧。
}
}
}
void Check()
{
if(textbox1.Text!="")//textbox1值不为空
{
if(textbox2.Text != "")//textbox2值不为空
{
//哇哈哈哈,终于写出来了!!!!
}
}
}
==
这个容易实现是当TEXTBOX1和TEXTBOX2都有值时,从后台数据库获得TEXTBOX3的值。请问高手们怎么实现?
==
这个什么意思?
是当TEXTBOX1和TEXTBOX2都有值时,从后台数据库获得TEXTBOX3的值。请问高手们怎么实现?
==
这个什么意思?就是TextBox3的内容随着TextBox1和TextBox2内容的变化而改变。因为TextBox3的值是把TextBox1和TextBox2的值作为查找条件从数据库中获得的,不知道我这次说清楚没有?呵呵。