需要代码确认并在页面后面的代码中继续 [英] Need code to confirm and proceed in code behind page
问题描述
我有一个场景在点击按钮后我需要从数据库中检索数据并根据我需要提醒确认的值消息框。如果在确认消息框中单击是,则需要执行剩余的代码集,否则退出按钮单击事件。
任何人都可以知道如何在asp.net中使用C#代码。
提前致谢。
问候,
Aditya。
在这里有一个llok: http://www.aspsnippets.com/Articles/ASPNet-Server-Side-Yes-No-Confirmation-Box -using-JavaScript.aspx [ ^ ]
hi试试此代码...
如果有任何疑问,请发表评论..
受保护 void btnsubmit_C lick( object sender,EventArgs e)
{
// 执行一些代码并获取值
bool value = true ;
if ( value )
{
string script = < script type = \text / javascript \ > var val = confirm('ur message ???'); if(val){calfun();}< / script>;
// this.Page.ClientScript.RegisterStartupScript(typeof(Page),alert,script);
// ScriptManager.RegisterStartupScript(this,typeof(Page),alert,message );
ScriptManager.RegisterStartupScript( this , typeof (页面),< span class =code-string> alert,script, false );
}
}
< pre lang =javascript>< script type = text / javascript>
function calfun()
{
alert(' 调用'跨度>);
// 调用服务器函数..(创建一个样式为dispay的按钮:none,并调用该按钮点击事件)
}
< / script>
Hi,
I have a scenario Where after clicking the button i need to retrieve the data from the database and based on the value i need to alert an confirmation message box. If yes is clicked in the confirmation message box then need to execute the remaining set of code else exit from the Button click event.
Can any one give an idea how to do in asp.net using C# code.
Thanks in advance.
Regards,
Aditya.
Have a llok here: http://www.aspsnippets.com/Articles/ASPNet-Server-Side-Yes-No-Confirmation-Box-using-JavaScript.aspx[^]
hi Try this code...
if any doubt , leave a comment..
protected void btnsubmit_Click(object sender, EventArgs e) { // do some code and get the value bool value = true; if (value) { string script = " <script type=\"text/javascript\"> var val = confirm('ur message ???'); if(val){calfun();} </script> "; // this.Page.ClientScript.RegisterStartupScript(typeof(Page), "alert", script); //ScriptManager.RegisterStartupScript(this,typeof(Page), "alert", message); ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", script, false); } }
<script type="text/javascript"> function calfun() { alert('calling'); // to call a server function.. ( create a button with style as dispay:none , and call that button click event ) } </script>
这篇关于需要代码确认并在页面后面的代码中继续的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!