大家好, 我想点击按钮时显示警告信息。 我应该拨打来自aspx的警告信息.cs文件。 我需要为邮件发送一个参数。 喜欢你想删除MYPARAMETER文件 并在单击确定的警告消息中我需要继续我的aspx.cs页面的下一步活动 如何执行此活动.. 如果我使用Javascript如何从.cs文件发送参数以及如何将控件返回到我的页面。 或任何其他方式要做到这一点。 请与我分享。 谢谢事先
Hi all, I want to show warning message on click of the button. I should call the warning message from aspx.cs file. and I need to send one parameter for the message. like "Do you Want to delete "MYPARAMETER" file" and in the warning message on click of ok I need to continue with the next step of activity from my aspx.cs page How to perform this activity.. If I use Javascript How to send parameter from .cs file and how to get the control back to my page. Or any other way to do it. Please share with me. Thanks in advance
推荐答案在服务器端使用客户端和服务器端都是一件令人困惑和艰巨的任务。 您可以做的就是将每个工作分配到他们自己的特定部门。您在客户端(JavaScript)处理客户端操作,然后在服务器端(C#)处理服务器端。 首先,创建一个按钮这将提醒用户他将做一些不可改变的事情。从HTML5开始,您可以在元素中拥有自己的自定义数据属性。使用Filename填充该属性,而不是调用C#代码来获取文件名。 Working with Client side and Server side all on the server side is a bit of confusing and hard task to do. What you can do is something like you seperate each job to their own particular departments. You handle the Client side actions on the Client side (JavaScript) and then handle the Server side on the Server side (C#). First of all, create a button that would alert the user that he's going to do something that is unchangeable. Since HTML5, you're allowed to have your own custom data attributes in the element. Populate that attribute with the Filename instead of calling a C# code to get the file name. <button id="showerror" data-file-name="file-name.png">Delete</button>
JavaScript的jQuery库让你了解少写更多。您可以将jQuery代码包含到文档中并执行jQuery代码,首先提醒用户,然后向服务器端发送请求以删除文件。在发送请求时,您将写入将删除文件的页面的URL,这样,只有在用户确认后才会将其传递给页面。为此,您可以使用确认对话框。
The jQuery library of JavaScript has got you covered to write less do more. You can include the jQuery code to your document and execute the jQuery code to first of all alert the user and after that, send a request to the server side to delete the file. While sending request you will write the URL of the page where the file will be deleted, this way you only get passed on to the page if the user confirms. For that you can make use of the confirm dialog box.
<script src="//code.jquery/jquery-1.11.0.min.js"> // library has been included in the src attribute( document )。ready( function (){ // 获取文件名 var filename = (document).ready(function () { // get the file name var filename =
(' showerror')。data(' file-name'); ('showerror').data('file-name');
更多推荐
如何在asp.net中单击按钮时显示警告消息
发布评论