引导模式弹出C#代码隐藏

编程入门 行业动态 更新时间:2024-10-28 17:29:23
本文介绍了引导模式弹出C#代码隐藏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我用引导我的C#asp项目,我想显示显示从后面的代码模式弹出。

i am using bootstrap in my c# asp project and i want to show to show the modal popup from code behind.

在我的网页标题,我有一个javascript函数如下:

in my page header i have a javascript function as follows:

function LoginFail() { $('#windowTitleDialog').modal('show'); }

和我按一下按钮我打电话的JavaScript如下:

and on the click of my button i am calling the javascript as follows

ScriptManager.RegisterClientScriptBlock(this, typeof(System.Web.UI.Page), "LoginFail", "LoginFail();", true);

这不显示模式弹出。不过,如果我使用像警报('登录失败'),它工作正常。

this does not show the modal popup. however, if i use something like alert('login failed'), it works fine.

任何人可以请与帮助呢?

can anybody please help with this?

推荐答案

在默认情况下引导的JavaScript文件只是在结束标记之前包括

By default Bootstrap javascript files are included just before the closing body tag

<script src="vendors/jquery-1.9.1.min.js"></script> <script src="bootstrap/js/bootstrap.min.js"></script> <script src="vendors/easypiechart/jquery.easy-pie-chart.js"></script> <script src="assets/scripts.js"></script> </body>

我把这些JavaScript文件到头部分身体标记之前,我写了一个小功能调用模式弹出:

I took these javascript files into the head section right before the body tag and I wrote a small function to call the modal popup:

<script src="vendors/jquery-1.9.1.min.js"></script> <script src="bootstrap/js/bootstrap.min.js"></script> <script src="vendors/easypiechart/jquery.easy-pie-chart.js"></script> <script src="assets/scripts.js"></script> <script type="text/javascript"> function openModal() { $('#myModal').modal('show'); } </script> </head> <body>

然后我可以调用从代码隐藏模式弹出与以下内容:

then I could call the modal popup from code-behind with the following:

protected void lbEdit_Click(object sender, EventArgs e) { ScriptManager.RegisterStartupScript(this,this.GetType(),"Pop", "openModal();", true); }

更多推荐

引导模式弹出C#代码隐藏

本文发布于:2023-10-06 19:51:35,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1467656.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:弹出   模式   代码

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!