小编Sha*_*eKm的帖子

Jquery克隆并重命名输入字段

我有以下内容:

<!-- group clone //-->
<div class="section">
    <div class="parent row infoOn">
        <div class="validGroup">
            <a title="remove" class="iconClose" href="#">remove</a>
                <div class="grouping">
                    <div class="clearfix valid">
                        <label>Name<span class="iconReq">&nbsp;</span>:</label>
                        <input type="password" class="text inpButton" name="items[0].first">
                    </div>
                    <div class="clearfix">
                        <label>Email<span class="iconReq">&nbsp;</span>:</label>
                        <input type="text" class="text inpButton" name="items[0].first">
                    </div>
                </div>
            </div>
        </div>
        <div class="row addControl">
            <a href="#" class="button">Add</a>
        </div>
    </div>
    <!-- group clone //-->
Run Code Online (Sandbox Code Playgroud)

和jQuery:

$(function(){
    // Control clone
    $('div.addControl a.button').click(function (e){
        e.preventDefault();
        var parent = $(this).closest('.section').find('.parent:last');
        var parentInput = parent.clone();
        parentInput.find("input").val("");
        parent.after(parentInput);
    });
    $('div.validGroup a.iconClose').live('click', function (e){
        e.preventDefault(); …
Run Code Online (Sandbox Code Playgroud)

javascript jquery javascript-events

5
推荐指数
1
解决办法
4817
查看次数

IE输入文件属性未定义

我有以下输入文件标记:

<input type="file" id="handlerxhr1" />
Run Code Online (Sandbox Code Playgroud)

在mozilla中,当我运行以下jQuery代码时:

var input = $('#handlerxhr1')[0];
        $('#upload').click(function() {
            alert(input.files[0]);

        });
Run Code Online (Sandbox Code Playgroud)

我得到回复:[对象文件](这很好).

但是在IE中我得到'input.files.0 is undefined'

我究竟做错了什么?谢谢.

javascript jquery internet-explorer mozilla

5
推荐指数
2
解决办法
3万
查看次数

Querystring - 在c#中为querystring添加值

如何为查询字符串添加值?

我正在尝试这样做:

String currurl = HttpContext.Current.Request.RawUrl;
var querystring = HttpContext.Current.Request.QueryString.ToString();

var PrintURL = currurl + (String.IsNullOrEmpty(querystring)) ?
    HttpContext.Current.Request.QueryString.Add("print", "y") : string.Empty;
Run Code Online (Sandbox Code Playgroud)

但我一直收到这个错误:

无法将类型'string'隐式转换为'bool'

我要做的就是获取当前网址并将"pring = y"添加到查询字符串

.net c# asp.net

5
推荐指数
2
解决办法
3万
查看次数

jquery设置tabindex和cursor

我有以下代码将tabindex分配给我的表单id"register1".一旦分配了tabindex,我想将光标放在表单上的第一个输入或选择列表项(tabindex = 1的项目).但是以下行:$('#register1').find('input').attr('tabindex',1).select(); 重置所有输入的tabindex.

完整代码:

$(function(){
    var tabindex = 1;
    $('#register1').find('input,select').each(function() {
        if (this.type != "hidden") {
            var $input = $(this);
            $input.attr("tabindex", tabindex);
            tabindex++;
        }
    });
    $('#register1').find('input').attr('tabindex',1).select();
});
Run Code Online (Sandbox Code Playgroud)

谢谢

javascript jquery jquery-ui jquery-plugins jquery-selectors

5
推荐指数
1
解决办法
2万
查看次数

当从页面导航时页面加载错误时,signalR中断

当导航离开具有signalR连接/连接集线器的页面时,我收到以下错误消息.

连接到 "http:// localhost:53604/signalr/signalr/connect?transport = serverSentEvents&connectionId = 0b308c0d-2122-4e60-a9fa-f6e3f3eb1f4e&connectionData =%5B%7B%22name%22%3A%22packageactionstatus%20%22%7D 页面加载时,%5D&tid = 9" 被中断.

我确实理解由于离开页面导致连接丢失(这是好的)但是在导航离开当前页面之前是否有一种安全的方法来停止连接?

asp.net asp.net-mvc signalr signalr-hub signalr.client

5
推荐指数
2
解决办法
2644
查看次数

Wix将项目加载到ComboBox中

我需要使用自定义操作将项目加载到组合框中.

UI.wxs:

            <Control Id="Server" Type="ComboBox" X="30" Y="65" Width="200" Height="18" Property="DATABASE_SERVER">
                <ComboBox Property="DATABASE_SERVER">
                    <ListItem Text="[DATABASE_SERVER]" Value="[DATABASE_SERVER]" />
                </ComboBox>
                <Publish Property="LOGON_VALID" Value="0">1</Publish>
            </Control>
Run Code Online (Sandbox Code Playgroud)

自定义操作

private static ActionResult EnumSqlServersIntoComboBox(Session session, IEnumerable<DataRow> rows)
{
    try
    {
        Debugger.Break();

        session.Log("EnumSQLServers: Begin");

        // Grab the combo box but make sure I'm getting only the one 
        // from WebAppInstallDlg.
        View view = session.Database.OpenView("SELECT * FROM ComboBox WHERE ComboBox.Property='DATABASE_SERVER'");
        view.Execute();

        Int32 index = 1;
        session.Log("EnumSQLServers: Enumerating SQL servers");
        foreach (DataRow row in rows)
        {
            String serverName = row["Name"].ToString();

            // …
Run Code Online (Sandbox Code Playgroud)

wix wix-extension wixlib wix3.6

5
推荐指数
1
解决办法
4971
查看次数

带有实例参数的SQL连接字符串

我正在尝试检查(在.net c#中)我是否能够连接到SQL服务器.但是每当我在连接字符串中指定实例时,我就无法再连接了.:

这有效:

builder.ConnectionString = "Server=DLS-534;user id=sa;password=Mypassword;initial catalog=master";
Run Code Online (Sandbox Code Playgroud)

这不起作用:

builder.ConnectionString = "Server=DLS-534\\SQL_2008_R2_DEV;user id=sa;password=Mypassword;initial catalog=master";
Run Code Online (Sandbox Code Playgroud)

为什么这不起作用?我确实需要能够连接到特定的实例,因为用户可能有几个dbs.

我的完整代码:

            SqlConnectionStringBuilder builder =
                new SqlConnectionStringBuilder();

builder.ConnectionString = "Server=DLS-534\\SQL_2008_R2_DEV;user id=sa;password=Mypassword;initial catalog=master";

            using (var connection = new SqlConnection(builder.ConnectionString))
            {
                try
                {
                    connection.Open();
                    return true;
                }
                catch (SqlException)
                {
                    return false;
                }
            }
Run Code Online (Sandbox Code Playgroud)

c# sql sql-server asp.net c#-4.0

5
推荐指数
1
解决办法
2万
查看次数

MVC5身份验证过滤器

新身份验证和以前的授权过滤器之间有什么区别?我没有看到任何区别.我一直用:[Authorize(Roles = "Admin, User")]

您何时需要使用身份验证过滤器?什么时候使用授权?

有人可以解释一下这个区别吗?样品会很棒.谢谢

asp.net-mvc-5

5
推荐指数
1
解决办法
5546
查看次数

建立MVC CMS

我需要一个简单的功能来在这些页面上添加页面/更改内容.我已经看过n2和其他预构建的CMS工具,但这些是我需要的简单CMS功能的高级方法.

什么是最好的方法?我已经有一个MVC应用程序,我想添加/构建一个简单的功能,如:

  1. 指定模板
  2. 向该模板添加区域
  3. 通过wysiwyg添加内容.

不知道从哪里开始.

任何信息非常感谢.谢谢

这适用于.NET MVC

asp.net-mvc wysiwyg template-engine content-management-system

4
推荐指数
1
解决办法
1727
查看次数

上传文件时的C#内存分配

问题与在MVC中上传文件有些相关.

上传文件时如何分配内存?

[HttpPost]
    public ActionResult FileUpload(string qqfile)
    {
            var stream = Request.InputStream;
Run Code Online (Sandbox Code Playgroud)

假设有人正在上传一个100 MB的文件,一旦Request.InputStream收到它会发生什么?

编辑:

Request.InputStream处理和处理退出时会发生什么ActionResult

  • 流存储在哪里?内存分配?
  • 何时处理?什么时候处理Request.InputStream?
  • 如果我将流存储在变量保存到的变量中?
  • 一旦动作结果退出,"流"变量会发生什么?
  • 变量"stream"持有什么?,一个Request.InputStream的引用/指针?或"完整"的字节副本(假设为100MB)?

c# asp.net-mvc asp.net-mvc-3

4
推荐指数
1
解决办法
719
查看次数