[求助]用脚本改变的属性在服务器端并没有改变呢?
如 protected void GVList_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
Label delaytypecd = (Label)e.Row.FindControl("GVlblDelayTypeCD");
Label delaytypedec = (Label)e.Row.FindControl("GVlblDelayTypeDec");
e.Row.Attributes.Add("onclick", "return setvalue('txtDelayTypeCD','txtDelayTypeDec','" +delaytypecd.Text.ToString()+ "','" +delaytypedec.Text.ToString()+ "');");
}
}
下面为脚本 txtDelayTypeCD txtDelayTypeDec为控件的id
<script language="javascript" type="text/javascript">
function setvalue(objtypecd,objtypename,typecd,typename)
{
var typecd1='ctl00$ContentPlaceHolder1$'+objtypecd;
var typename1='ctl00$ContentPlaceHolder1$'+objtypename;
document.all(typecd1).value=typecd;
document.all(typename1).value=typename;
}
</script>
我点击数据行时txtDelayTypeCD txtDelayTypeDec的值能改变 并显示
但在写服务器端代码的时候
this.txtDelayTypeCD.Text并没有改变,是没有执行JS脚本的值
但界面上显示的是执行js的值。