本文介绍了请建议我编辑一个表单的代码我在ASP.NET中的threetire系统中完成了我的项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 protected void Button1_Click(对象发​​件人,EventArgs e) { EditProfileBL objBL = new EditProfileBL(); objBL.profilefor = DropDownList1.Text; objBL.name = TextBox1.Text; objBL.gender = RadioButtonList1.SelectedItem.Text; objBL.dateofbirth = DropDownList2.Text + - + DropDownList3.Text + - + DropDownList4.Text; objBL.edit(objBL); clear(); Response.Write( < Script> alert('editfully')< / Script> ); } 这是我的源代码 我尝试过: protected void Button1_Click(object sender,EventArgs e) { EditProfileBL objBL = new EditProfileBL(); objBL.profilefor = DropDownList1.Text; objBL.name = TextBox1.Text; objBL.gender = RadioButtonList1.SelectedItem.Text; objBL.dateofbirth = DropDownList2.Text + - + DropDownList3.Text + - + DropDownList4.Text; objBL.edit(objBL); clear(); Response.Write(< Script> alert('编辑成功')< / Script>); } 解决方案 试试这个 public void ShowMessage( string message) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append( < script type ='text / javascript'> ); sb.Append( window.onload = function(){); sb.Append( alert('); sb.Append (消息); sb.Append( ')};); sb.Append( < / script>); ClientScript.RegisterClientScriptBlock( this .GetType(), alert,sb.ToString()); } 受保护 void btnSave_Click( object sender,EventArgs e) { // 您的代码 // // // 您的代码 ShowMessage( 已成功保存!! ); } protected void Button1_Click(object sender, EventArgs e) {EditProfileBL objBL = new EditProfileBL(); objBL.profilefor = DropDownList1.Text; objBL.name = TextBox1.Text; objBL.gender = RadioButtonList1.SelectedItem.Text; objBL.dateofbirth = DropDownList2.Text + "-" + DropDownList3.Text + "-" + DropDownList4.Text;objBL.edit(objBL); clear(); Response.Write("<Script>alert('edited Successfully')</Script>"); }this is my source codeWhat I have tried:protected void Button1_Click(object sender, EventArgs e) { EditProfileBL objBL = new EditProfileBL(); objBL.profilefor = DropDownList1.Text; objBL.name = TextBox1.Text; objBL.gender = RadioButtonList1.SelectedItem.Text; objBL.dateofbirth = DropDownList2.Text + "-" + DropDownList3.Text + "-" + DropDownList4.Text; objBL.edit(objBL); clear(); Response.Write("<Script>alert('edited Successfully')</Script>"); } 解决方案 Try thispublic void ShowMessage(string message) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append("<script type = 'text/javascript'>"); sb.Append("window.onload=function(){"); sb.Append("alert('"); sb.Append(message); sb.Append("')};"); sb.Append("</script>"); ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", sb.ToString()); } protected void btnSave_Click(object sender, EventArgs e) { // Your code // // // Your code ShowMessage("Saved Successfully!!"); } 这篇关于请建议我编辑一个表单的代码我在ASP.NET中的threetire系统中完成了我的项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-31 16:44