如果我将服务器控件的 ClientID 传递给 javascript,我可以设置服务器控件的值吗?
<script type="text/javascript">
function FillTextFromPopup(text) {
alert(text);
var myID = '<%= Session["myID"].ToString() %>';
alert(myID);
document.getElementById(myID).value = 'abc';
}
</script>
protected void LinkButton1_Click(object sender, EventArgs e)
{
GridViewRow gvRow = (GridViewRow)(sender as Control).Parent.Parent;
int index = gvRow.RowIndex;
LinkButton lnk = (LinkButton)gvRow.FindControl("LinkButton1");
string id = lnk.ClientID;
Session["myID"] = id;
string myScript;
myScript = "<script>window.open('PopUpTest1.aspx?',null,'height=750, width=1024,status= no,resizable= no, scrollbars=yes,toolbar=no,location=no,menubar=no'); </script>";
ScriptManager.RegisterStartupScript(this, this.GetType(), "pop", myScript, false);
}