客户端调用不刷新页面(Anthem)

如果需要在客户端的button按钮点击的时候先去操作数据库然后在做一些其他事,这样每个客户端可以单独执行,并不影响效率

1)button的描述

<asp:Button ID= "Button2" runat= "server" Text= "submit to ops" CssClass= "button2"
OnClientClick= "javascript:return submitToOPS();" Height= "20px" Width= "113px"
OnClick= "Button2_Click" />

2)script函数submitToOPS()

< script type ="text/javascript" >
function submitToOPS()
{

if(!checkSelect())
{
alert("Please select one item!");
return false;
}
$('callInfo').style.display="";
CallBackToOPS();

return false;
}

function CallBackToOPS()
{
Anthem_InvokePageMethod(
                    'SendToOPS',
                    [],
                    function(result) {
                        if(result.value.length!=0)
                        {
                         $('callInfo').style.display="none";
                         open('../batch.aspx?type=0','','height=450,width=800,top=200,left=120,toolbar=no,menubar=no,scrollbars=no, resizable=yes,location=no, status=no');
                        }
                    }
            );
}


</script>

3)服务器函数SendToOPS()

[Anthem.Method]
public string SendToOPS()
{
string result = string.Empty;
if (GridView1.Rows.Count != 0)
{
for (int i = 0; i < GridView1.Rows.Count; i++)
{
GridViewRow row = GridView1.Rows[i];
System.Web.UI.WebControls.CheckBox checkBox = (System.Web.UI.WebControls.CheckBox)row.FindControl("CheckBox1");

string id = GridView1.DataKeys[i]["Booking_No"].ToString();
string carrier = GridView1.DataKeys[i]["Carrier"].ToString();
string branch = this.GridView1.DataKeys[i]["Mlog_Entity"].ToString();
if (checkBox.Checked)
{
SubmitBatch(id, carrier, branch);
}

}

result = "ok";
}

return result;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值