<%@ Import Namespace="System.Data" %>
<asp:HiddenField ID="hfOrdinaryType" runat="server" />
<script type="text/javascript">
function onClickReg()
{
document.getElementById("<%=hfOrdinaryType.ClientID%>").value=type.toString();
}
</script>
<!--ajax-->
web.config
<httpHandlers>
<add verb="POST,GET" path="ajax/*.ashx" type="Ajax.PageHandlerFactory, Ajax"/>
</httpHandlers>
<script type="text/javascript">
function onClickReg()
{
Soft_NewGroup.SetHfType(1,type);
}
</script>
public partial class Soft_NewGroup : WebBasePage
{
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
//注册Ajax类型
Ajax.Utility.RegisterTypeForAjax(typeof(Soft_NewGroup));
}
}
[Ajax.AjaxMethod()]
public void SetHfType(int id,int iType)
{
if (id == 1)
hfOrdinaryType.Value = iType.ToString();
else if (id == 2)
hfSpontaneousType.Value = iType.ToString();
else
hfFixedType.Value = iType.ToString();
}
}