Javascript调用C#里的函数
Javascript调用C#里的函数
<input id= "fleRead " type= "file " runat= "server " onreadystatechange= "btnReadImg_Click(); " onpropertychange= "document.all._ctl0_ContentPlaceHolder_Condition_imgPhoto.src= 'file:/// '+this.value; document.all._ctl0_ContentPlaceHolder_Condition_hidUrl.value=this.value; " enableviewstate=true/>
<asp:button id= "btnReadImg " tabIndex= "-1 " runat= "server " CssClass= "CommonButton " Text= "取込 "> </asp:button>
C#里
protected void btnReadImg_Click()
{
}
怎么调用btnReadImg_Click()?
------解决方案--------------------利用_dopostback,
就http://www.cnblogs.com/flyinging/archive/2006/10/10/524982.html
------解决方案--------------------用页面回传机质
也就是楼上说的_dopostback(),去网上查查查关资料
------解决方案-------------------- <script>
function func()
{
document.getElementById( 'btnReadImg ').click();
}
</script>
------解决方案--------------------1.拖一个linkbutton到页面
2.双击产生后台事件linkButton_Click(...)
3.隐藏按钮:linkbutton.Style.Add( "display ", "none ");
4.前台调用, onclick= "javascript:__doPostBack( 'linkButton ', ' ') "
够清楚不?