当我单击“保存"按钮以保存数据时,以及当我单击“取消"按钮时,必须有一个弹出的局部视图时,如何在表单中实现多个按钮? [英] how can i implement multiple button in a form when i click save button it saves data and when i click the cancel button then there must be a popup partial view ?

查看:64
本文介绍了当我单击“保存"按钮以保存数据时,以及当我单击“取消"按钮时,必须有一个弹出的局部视图时,如何在表单中实现多个按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实际上我想做的是
我有两个按钮,一个保存另一个,取消
当我单击保存按钮时,它必须将d数据保存到数据库中

当我单击取消"按钮时,它必须呈现一个包含确定要取消吗?"的弹出式局部视图.

我怎样才能做到这一点?帮助!

Actually what i want to do is
i have two buttons one save another cancel
when i click save button it must save d data into database
and
when i click cancel button it must render a popup partial view containing "Are you Sure you want to cancel?"

how can i do this? help! help!!

推荐答案

hi 您可以使用AJAX确认框
hi you can use AJAX confirmation box
<asp:Button ID="updatebutton" runat="server" Text="UPDATE" />
                             <asp:ConfirmButtonExtender ID="updatebutton_ConfirmButtonExtender"

                                 runat="server" ConfirmText="" Enabled="True" >
                             </asp:ConfirmButtonExtender>




请参阅此链接

http://csharp-guide.blogspot.in/2012/06/aspnet-jquery-ui-confirm-dialog.html [ ^ ]



你可以用这个



or
refer this link

http://csharp-guide.blogspot.in/2012/06/aspnet-jquery-ui-confirm-dialog.html[^]

or

u can use this

System.Web.HttpContext.Current.Response.Write("<SCRIPT LANGUAGE=""JavaScript"">var r=confirm(""Press a button"");" _
+ "if (r==true)  { alert(""You pressed OK!""); return true; }        else  {  return false ; alert(""You pressed Cancel!""); return false;  }</SCRIPT>")

>



在取消"按钮中使用此:
Hi,
In cancel button use this:
<asp:button id="btnCancel" runat="server" text="Cancel" onclientclick="javascript:return confirm('Are you sure you want to delete');"/>



要将数据保存在数据库中,可以使用过程 [参数 [ ^ ],以便将数据保存到数据库中.



--Amit



For saving the data in database you can use the OnClick[^] event of the asp button control. You can call your procedure[^] and pass the parameters[^] in that to save the data in database.



--Amit


@using(Html.BeginForm("t","Test",FormMethod.Post))
{
@ Html.ValidationSummary(true)
@ Html.AntiForgeryToken("PostData")
@ *
@ Html.Label(名称")
@ Html.TextBox(名称")
@ Html.Label(检查")
@ Html.TextBox(检查")* @
@ * @ Html.EditorFor(m => m.Address.AreaName)
@ Html.EditorFor(m => m.custindi.FirstName)* @

@ Html.TextBox("Name",(string)ViewBag.FBUserLastName)


<输入类型=提交" name ="area" value =创建" id =创建"/>
< input type ="submit" name ="Areaget" value =发布"/>
@ *< button name ="button" value ="area"> Area</button>
26:< button name ="button" value ="areaget"> AreaGet</button> * @ @ * @ Html.ActionLink("Search","Search","Home",新{id = Model.album_id })* @

@using (Html.BeginForm("t", "Test", FormMethod.Post))
{
@Html.ValidationSummary(true)
@Html.AntiForgeryToken("PostData")
@*
@Html.Label("Name")
@Html.TextBox("Name")
@Html.Label("Check")
@Html.TextBox("Check")*@
@* @Html.EditorFor(m=>m.Address.AreaName)
@Html.EditorFor(m=>m.custindi.FirstName)*@

@Html.TextBox("Name", (string)ViewBag.FBUserLastName)


<input type="submit" name="area" value="Create" id="create" />
<input type="submit" name="Areaget" value="Post" />
@* <button name="button" value="area">Area</button>
26: <button name="button" value="areaget">AreaGet</button>*@ @* @Html.ActionLink("Search", "Search", "Home", new { id = Model.album_id }) *@


这篇关于当我单击“保存"按钮以保存数据时,以及当我单击“取消"按钮时,必须有一个弹出的局部视图时,如何在表单中实现多个按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆