基本帮助SimpleModal和ASP.NET [英] Basic Help with SimpleModal and ASP.NET

查看:262
本文介绍了基本帮助SimpleModal和ASP.NET的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要感谢埃里克生产SimpleModal和恭维的演示。它看起来棒极了。

I want to thank Eric for producing SimpleModal and compliment the demos. It looks fantastic..

我只希望我能弄清楚如何使用它。(这是我,我错过了一些染色体或什么的。)提前对不起,我noobinicity。

I only wish I could figure out how to use it.. (it's me, I'm missing some chromosome or something.) Sorry in advance for my noobinicity.

我见过几个演示,其中具体职能谈论并呼吁,但这种假设脚本正确地整合到项目中。这是我遇到的问题的症结所在,我不知道我在看的时候我看的jQuery究竟发生了什么。

I've seen several demos where specific functions are talked about and called, but this assumes that the scripts are integrated correctly into the project. This is the crux of the issue I am having, I don't know what the heck I'm looking at when I look at jquery.

一些背景:我已经编写了25年,汇编,C,VB,并在过去的10年作为一个SQL数据库管理员和架构大型企业系统。现在我试图使飞跃网页ASP.NET。我的C#技能磨磨蹭蹭,我已经在它写一个完整的进销存系统,但我不知道蹲关于获得这个SimpleModal或集成和内部2008 ASP.NET工作的jQuery的。

我已经采取了样本code和粘贴成一个Default.aspx文件,只留给总垃圾code堆。

I've taken the sample code and pasted it into a default.aspx file, only to be left with a total trash code heap.

有人可以做什么,我需要得到SimpleModal正确集成到我的项目小样本?我读过Eric的答复他人和读取后续的联系,但没有人还没有​​解释如何整合完全是,我已经找到。

Can someone make small sample of what I need to get SimpleModal integrated properly into my project? I've read Eric's replies to others and read the subsequent links, but nobody has yet to explain how to entirely integrate it that I've found.

我假设我需要有CSS,IMG,和JS文件夹和放大器;文件在项目中。检查,我得到了根。从那以后,我不知道要找谁。我的猜测是,它需要近code的页面顶部被声明,然后在HTML链接,并在code背后,它需要被调用。如何做到这一点我是无法理解的,我已经花了也许是3-4天,现在研究这个...

I'm assuming that I need to have the css, img, and the js folders & files in the project. Check, I got that in the root. After that I don't know where to turn. My guess is that it needs to be declared near the top of the code on a page, and then in the HTML a link, and in the code behind it needs to be called. How to do that is beyond me, and I've spent perhaps 3-4 days researching this now...

一旦我有一个简单的模式窗体弹出上下我应该能够看混账东西,并找出如何去适应它,并希望随着时间的推移将开始填补了我的理解的差距。

Once I have a simple modal form popping up and down I should be able to look at the darn thing and figure out how to adapt it, and hopefully over time will begin to fill in the gaps of my understanding.

下面是一个示例Default.aspx文件的样子。我想用从code后面有个C#调用打开一个SimpleModal。

Here is what a sample default.aspx file looks like. I want to open a SimpleModal using a C# call from Code Behind.

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>

    </div>
    </form>
</body>
</html>

这是一个什么样的默认$ C $在C#中落后C相类似:

This is what a default sample code behind in c# looks like:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
}

有人想采取射击在获得SimpleModal地集成到一个默认的项目?

Anybody want to take a shot at getting SimpleModal simply integrated into a default project?

任何帮助将大大AP preciated。

Any help would be greatly appreciated.

维克托

推荐答案

我认为你从一个纯粹的code-背后的角度接近这一点;但是使用jQuery(或大多数其他任何客户端框架)转移你的应用程序客户端的实际presentation了很大的。服务器处理提供了数据(XML,JSON或者你需要一些其他的格式)和客户端使用的HTML DOM结构用JavaScript一起,CSS和数据,以便使您的应用程序担任了。

I think you're approaching this from a pure code-behind perspective; but using jQuery (or most any other client-side framework) shifts a great deal of the actual presentation of your application to the client. The server handles serving up data (in XML, JSON or some other format that you require) and the client utilizes an HTML DOM structure along with JavaScript, CSS and the data served up in order to render your application.

在你的评论,你的状态,你要使用的模式为确认一个动作是成功的。在这里,你会使用jQuery来收集信息,并发出AJAX调用服务(可能是一个WCF服务),服务将与成功或失败进行回应。然后,您可以处理您的jQuery阿贾克斯成功或错误回调处理程序是成功还是失败。这将在客户端上进行,而不是在服务器上。

In your comment, you state that you want to use the modal as a confirmation that an action was successful. Here you'd use jQuery to collect the information and issue an AJAX call to your service (perhaps a WCF service), and the service would respond back with a success or failure. You would then handle the success or failure in your jQuery ajax success or error callback handler. This would be done on the client, not on the server.

下面是一个简单的例子,只有显示模式:

Here's a quick example that only displays the modal:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <style type="text/css">
        #simplemodal-overlay {background-color:#000;}
        #simplemodal-container {background-color:#333; border:8px solid #444; padding:12px;}
    </style>
</head>
<body>
    <div>
        Email: <input type="text" id="email" /><br />
        Message: <input type="text" id="message" /><br />
        <button id='theModal'>Show</button>
        <div id="sample" style="display:none"> 
            <h2>Sample Data</h2> 
            <p>Your email was successful!!</p> 
            <p>You can press ESC to close this dialog or click <a href="#" class="simplemodal-close">close</a>.</p> 
        </div> 
    </div>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
    <script type="text/javascript" src="http://simplemodal.googlecode.com/files/jquery.simplemodal-1.3.5.js"></script>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#theModal").click(function () {
                $("#sample").modal({
                    opacity: 80,
                    overlayCss: { backgroundColor: "#fff" }
                });
            });
        });
    </script>
</body>
</html>

这就是没有code-背后基本的HTML页面。我可以修改此调用点击提交按钮当服务:

This is just a basic HTML page with no code-behind. I could modify this to call a service when the submit button is clicked:

$("#theModal").click(function () {
    $.ajax({
      type: "POST",
      dataType: "json",
      contentType: "application/json",
      url: "MyEmailService.svc/SendEmail",
      data: {"email": $("#email").val(),
             "message": $("#message").val()},
      success: function(data) {
                 $("#sample").modal({
                     opacity: 80,
                     overlayCss: { backgroundColor: "#fff" }
                 });
      },
      error: function(m, t, x) { alert("something bad happened"); }
    });
});

这是所有的伪code,因为该服务不存在,但希望我正确传达的例子。但在这种伪$ C $℃实施例中,服务将处理的电子邮件的功能,并返回给客户机并成功回调处理程序将被执行(这将显示模态)作出响应。如果在与服务进行通信或分析返回值的问题,那么错误回调处理程序被调用。

This is all pseudo-code because the service doesn't exist, but hopefully I've conveyed the example properly. But in this pseudo-code example, the service would process the email functionality and respond back to the client and the success callback handler would be executed (which would display the modal). If there is a problem in communicating with the service or parsing the return value, then the error callback handler gets called.

请让我知道如果这有助于。如果您有其他疑问,请让我知道,我会相应地更新我的答案。希望这有助于!

Please let me know if this helps. If you have other questions, let me know and I'll update my answer accordingly. Hope this helps!!

这篇关于基本帮助SimpleModal和ASP.NET的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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