private void Page_Load(object sender, System.EventArgs e)
{
ddlQuery.Attributes.Add("onchange","changeSearchText();");
if(!this.Page.IsPostBack)
{
PageNaivegate();
}
}
====================
<script language="javascript" type="text/javascript">
function changeSearchText()
{
alert(111);
}
</script>
====================================================
2
private void Page_Load(object sender, System.EventArgs e)
{
string target=Request.Params["__EVENTTARGET"];
string args=Request.Params["__EVENTARGUMENT"];
ddlQuery.Attributes.Add("onchange","changeSearchText();");
AjaxPro.Utility.RegisterTypeForAjax(typeof(mrp.hk.vendorManageUI));
if(!this.Page.IsPostBack || (target != null && target=="pagesizeChange"))
{
PageNaivegate();
}
}
--------------------------
<script language="javascript" type="text/javascript">
var pagesize = "<%=PagesizeControl%>";
function changePageSize(control)
{
if(control.value=="更改頁面大小")
{
document.getElementById(pagesize).style.display="";
control.value="確定";
}
else
{
document.getElementById(pagesize).style.display="none";
control.value=="更改頁面大小"
__doPostBack("pagesizeChange","pagesizeChange");//调用服务端事件
}
}
function changeSearchText()
{
alert(111);
}
</script>
========================DataGrid 绑定项调用JAVASCRIPT,客户端========
3 private void dgDraw_ItemDataBound(object sender, System.Web.UI.WebControls.DataGridItemEventArgs e)
{
if(e.Item.ItemType != ListItemType.Header)
{
if(e.Item.Cells[11].Text == "1")
{
e.Item.Cells[11].Text="可领料";
e.Item.BackColor=System.Drawing.Color.LightGreen;
}
else if(e.Item.Cells[11].Text == "0")
{
e.Item.Cells[11].Text="缺料";
e.Item.BackColor=System.Drawing.Color.FromArgb(144,238,255);
}
else if(e.Item.Cells[11].Text == "2")
{
e.Item.Cells[11].Text="料领完";
e.Item.BackColor=System.Drawing.Color.LightGreen;
}
e.Item.Cells[12].Text="<span onclick=\"openGetInfo('"+e.Item.Cells[0].Text+"')\" style='CURSOR: hand'>查 看</span>";
e.Item.Cells[1].Text="<span onclick=\"openGetInfo('"+e.Item.Cells[0].Text+"')\" style='CURSOR: hand'>"+e.Item.Cells[1].Text+"</span>";
}
}
----------------------
<script language="javascript">
function openGetInfo(value)
{
window.open('projectDetailinfo.aspx?vgetID='+value+'','aaaa','height=720,width=800,top=0,left=8,scrollars=yes');
}
</script>