c# webform下,txtbox,dropdownlist失去焦点时,如何激活一个函数(C#函数,非java)!急呀!要多急有多急,大家帮着顶一下! onblur要作为角本写到客户端的.不能在服务器端. 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 提议写在客户端控件中这么写<asp:TextBox id="TextBox1" runat="server" onblur="onLostFocus();"></asp:TextBox>在JavaScript中这么写function onLostFocus(){ var objbutton1=document.getElementById("Button1"); //调用服务器端的单击事件 objbutton1.click();} 需要提交才可以的不妨用下面的方法考虑一下:使用一个LinkButton控件LinkButton1在page_load()如下:this.txtMediaDate.Attributes["onblur"] = "__doPostBack('"+this.LinkButton1.ClientID+"','')"; this.LinkButton1.Attributes.CssStyle["display"]="none";this.LinkButton1_Click+=new System.EventHandler(MediaDate_LostFocus);把你的MediaDate_LostFocus()方法改写成LinkButton1的单击事件private void MediaDate_LostFocus(object sender, System.EventArgs e){ //一个测试用的函数 } private void TextBox_Leave(object sender, EventArgs e){} 最好在客户端用javascript处理,不值得让数据往返一次 唉!我定义了一个datatable,目的是在客户端动态的加载这个datatable中的数据而已,在加载页面的时候,就把这个datatable加载进来了!以后访问这个对象还需要同server交互吗? 调用SQLSERVER数据库时,SQL的LIKE语句动态绑定参数是,检索不到数据。。。 最后一次提问,不解决,再不提部了 关于使用微软的AntiXss出现乱码问题 如何实现鼠标移动到listview的某行时,有一个浮动窗体显示详细信息? 求一本有关C#串口通信的书籍(最好是英文) 在c# 怎样引用 ado连接sql数据库,高手们帮帮忙? 有关图象处理的两个问题 关于foreach循环 将截断字符串或二进制数据 遍历list c#中怎样创建罗辑字体(logfont)? 在ASP.net中连接SQL Server
<asp:TextBox id="TextBox1" runat="server" onblur="onLostFocus();"></asp:TextBox>在JavaScript中这么写
function onLostFocus()
{
var objbutton1=document.getElementById("Button1");
//调用服务器端的单击事件
objbutton1.click();
}
不妨用下面的方法考虑一下:使用一个LinkButton控件LinkButton1
在page_load()如下:
this.txtMediaDate.Attributes["onblur"] = "__doPostBack('"+this.LinkButton1.ClientID+"','')";
this.LinkButton1.Attributes.CssStyle["display"]="none";
this.LinkButton1_Click+=new System.EventHandler(MediaDate_LostFocus);把你的MediaDate_LostFocus()方法改写成LinkButton1的单击事件
private void MediaDate_LostFocus(object sender, System.EventArgs e)
{
//一个测试用的函数
}