嗨,我想根據查詢顯示或隱藏重複記錄。所以,我需要知道如何從C#代碼隱藏中調用JavaScript函數。在C中調用javascript函數#
<a onclick="Grid1.insertRecord(); return false;" id="a2" href="javascript:">Save</a>
當我點擊保存我需要證明我所用JavaScript編寫的彈出窗口。
if (!exist)//exists is the query
{
System.Web.UI.Control my = FindControl("a2");
a2.Attributes.Add("onclick", "retrun HideDuplicate()");
該行返回一個錯誤,指出「a2在當前上下文中不存在」。
這是你在找什麼? http://stackoverflow.com/questions/1265887/call-javascript-function-on-hyperlink-click – paparush 2011-03-26 23:16:03