更新时间:2023-11-27 22:17:58
添加OnClick =btnOk_Click
属性为 Ok按钮。
确保 Ok按钮有runat =服务器
属性设置。
然后将代码放在btnOk_Click
事件中。
AddOnClick="btnOk_Click"
attribute to the Ok Button.
Make sure Ok Button hasrunat="server"
attribute set.
Then place the code insidebtnOk_Click
Event.
protected void btnOk_Click(Object sender, EventArgs e)
{
// Your code here.
}
您可以使用onclientclick返回true或false(这是您显示确认消息的方式)如果返回true,则将触发服务器端单击。或者您可以通过ASP.NET AJAX或jquery使用AJAX来提交数据。
ASP.NET非常糟糕,你应该开始学习MVC,因为我无法想象任何新项目使用webforms的任何理智的原因。
You can use onclientclick to return true or false ( that's how you show a confirmation message ) and if it returns true, the server side click will fire. Or you can use AJAX, via ASP.NET AJAX or via jquery, to submit your data.
ASP.NET is pretty awful, you should set out to learn MVC instead because I can't imagine any sane reason for any new project to use webforms.
cmd.Parameters.Clear();
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@mode", "confirmlog");
cmd.Parameters.AddWithValue("@username", Session["usern"]);
cmd.Parameters.AddWithValue("@appid", Session["appid"]);
cmd.Parameters.AddWithValue("@userip", Request.UserHostAddress);
cmd.Parameters.Add("@retval", SqlDbType.Int).Direction = ParameterDirection.ReturnValue;
cmd = ce.exe_procedure("sp_getstudent_info", cmd);
int j = Convert.ToInt16(cmd.Parameters["@retval"].Value);
DataSet Ds1 = new DataSet();
if (i == 1)
{
ServiceReference1.ServiceClient SendChl = new ServiceReference1.ServiceClient();
SqlCommand cmd1 = new SqlCommand();
cmd1.Parameters.AddWithValue("@ChallanNo", Session["appid"].ToString());
cmd1 = ce.exe_procedure("Reg_Convo_GetInfo_ByChallan", cmd1);
Ds1 = ce.executeprocedure_Dataset(cmd1);
if (Ds1.Tables[0].Rows[0][0].ToString() != "")
{
string s = Ds1.Tables[0].Rows[0][0].ToString();
SendChl.ImportChallanXML(Session["appid"].ToString(), s);
}
if (Convert.ToString(Session["AmtType"]) == "Online Payment")
{
Response.Redirect("must go to online payment gateway"] + "");
}
else
{
Response.Redirect("Loginnext.aspx");
}
}
这就是你要找的东西。
谢谢大家。
that is all what you were looking for.
Thanks to all.