刚刚接触c#,有这样的需求,不知道该怎么实现
具体如下,请大家帮忙看看
Textbox1,在textBox1中输入 1123AA
然后将1123作为参数传递给Texbox2,这样可以获取到,但是要将获取到的1123作为一个参数调用关于的方法就不行了,具体代码如下: string str = this.Cus_id.Text;//这个是获取Textbox1中的文本值
CustomerBLL Scinfo = new CustomerBLL();调用相关业务逻辑方法
IList<Customer> ISC = Scinfo.GetinfoBywhere(" Id=" + Convert.ToInt32(str));
foreach (Customer sc in ISC)
{
this.qty.Text = sc.name_EN;
}
可能我的业务逻辑有点问题,具体的需求就是当textbox1的onkeyup事件出发后,获取textbox1中的参数值,将其传递给textbox2,但是textbox2中显示的不是获取到的参数的值,而是这个参数经过相关的方法后的值..请大家赐教,谢谢
具体如下,请大家帮忙看看
Textbox1,在textBox1中输入 1123AA
然后将1123作为参数传递给Texbox2,这样可以获取到,但是要将获取到的1123作为一个参数调用关于的方法就不行了,具体代码如下: string str = this.Cus_id.Text;//这个是获取Textbox1中的文本值
CustomerBLL Scinfo = new CustomerBLL();调用相关业务逻辑方法
IList<Customer> ISC = Scinfo.GetinfoBywhere(" Id=" + Convert.ToInt32(str));
foreach (Customer sc in ISC)
{
this.qty.Text = sc.name_EN;
}
可能我的业务逻辑有点问题,具体的需求就是当textbox1的onkeyup事件出发后,获取textbox1中的参数值,将其传递给textbox2,但是textbox2中显示的不是获取到的参数的值,而是这个参数经过相关的方法后的值..请大家赐教,谢谢
{
if(this.TextBox1.Text.Trim()!="")
this.TextBox2.Text=this.TextBox1.Text;
}
protected void TextBox1_TextChanged(object sender, EventArgs e)
{
TextBox2.Text = TextBox1.Text;
}
function Set(str) {
document.getElementById("Textbox2").value=str;
}
CustomerBLL Scinfo = new CustomerBLL
IList<Customer> ISC = Scinfo.GetinfoBywhere("Id=" + Convert.ToInt32(str));
foreach (Customer sc in ISC)
{
this.qty.Text = sc.name_EN;
}
方法没问题,ISC 是否有值
function getValues(){
document.getElementById("<%=TextBox2.ClientID%>").value=document.getElementById("<%=TextBox1.ClientID%>").value;
}<asp:TextBox ID="TextBox2" runat="server" onchange="getValues();"/>
{
var xmlhttp=null;
try{xmlhttp=new XMLHttpRequest();}
catch(MSIEx){
try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}
catch(e){
try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}
catch(e)
{alert("您的浏览器不支持ajax!");}
}
}
return xmlhttp;
}
function getinfo()
{
with(document.form1)
{
if(TextBox1.length==0) {return;}
var id=TextBox1.value;
var x=creatXMLHTTP();
var url='Ajaxcodeget.aspx?id='+id+'&s='+ new Date().getTime();
x.open('GET',url,true);
x.onreadystatechange = function(){
if (x.readyState == 4 && x.status == 200) {
//alert(xmlHttp.responseText);
var s = x.responseText;
textbox2.value=s;
}
}
x.send(null);
}
}2.Ajaxcodeget.aspx
在pageload事件里面获取传递过来的参数:
if (Request.QueryString["id"]!="")//判断传递的参数是否为空
{
int id = Convert.ToInt32(Request.QueryString["id"]);
//写具体的方法
....
string s=...
response.write(s);
response.End();
}