小编Jim*_*988的帖子

获取当前页面URL而不使用查询参数 - Razor Html帮助程序?

Razor中是否有一个方法返回当前页面URL而不使用查询参数.

我需要把它推到我作为字符串创建的HTML帮助器方法中.

@Url似乎不起作用,如果我这样做,.ToString()我只是得到名称空间LOLLL

剃刀使用:

<th width="100%" @Html.SortTableClickEvent(@Url.ToString(), "Name")>
Run Code Online (Sandbox Code Playgroud)

Html帮手:

    public static MvcHtmlString SortTableClickEvent(this HtmlHelper html, string url, string column)
    {
        StringBuilder sortingPropertiesObject = new StringBuilder();
        sortingPropertiesObject.Append("var properties = new James.prototype.Table.SortingProperties();");
        sortingPropertiesObject.Append("properties.url = \"" + url + "\"");
        sortingPropertiesObject.Append("properties.colName = \"" + column + "\"");

        string clickEvent = "onclick = James.Table.SortByColumn(properties, this);";

        return MvcHtmlString.Create(sortingPropertiesObject + clickEvent);
    }
Run Code Online (Sandbox Code Playgroud)

什么输出到我的HTML:

<th width="100%" onclick='James.Table.SortByColumn("Name",' this);="" properties.colname="Name" james.prototype.table.sortingproperties();properties.url="System.Web.Mvc.UrlHelper" properties="new" var="">
            Name
        </th>
Run Code Online (Sandbox Code Playgroud)

c# razor visual-studio-2013

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

丢弃外键的问题

我的外键与它自己的表有关.这是为了生成具有层次结构的帖子.

现在当我尝试删除数据库中的列时,它给了我这个错误:

1553 - Cannot drop index 'post_field_properties_parent_id_index': needed in a foreign key constraint
Run Code Online (Sandbox Code Playgroud)

这是代码:

public function down()
{
        Schema::table( "post_field_properties", function( $table )
        {
            $table->dropForeign('parent_id');
            $table->dropColumn('parent_id');
        } );
}
Run Code Online (Sandbox Code Playgroud)

我似乎能够做到的唯一方法是转到phpmyadmin并删除外键本身.然后放下列.

php mysql laravel artisan

12
推荐指数
3
解决办法
9011
查看次数

如何使用Razor从我的视图中调用控制器操作?

我有2个控制器

- HomeController
    - Index()
- AccountController
    - Login()
Run Code Online (Sandbox Code Playgroud)

在我的Home/Index.cshtml中,我想加载AccountController/Login方法,然后返回一个视图并在我的Home/Index视图中显示它.

首页/ Index.cshtml

<div class="row-fluid">
    <div class="col-md-12">
        <!-- Render the view that the AccountController/Login method denotes -->
    </div>
</div>
Run Code Online (Sandbox Code Playgroud)

我该怎么做呢?

c# asp.net-mvc razor

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

FXC:错误X3501:'main':找不到入口点

我正在关注一本名为" DirectX 11的3D游戏编程简介"的示例书

它全部用VS2010编写.我想尝试使用VS2013 ......这是Windows桌面程序的示例项目

我有一个程序包含以下内容(包括一些其他文件作为常用的一部分):

color.fx

//***************************************************************************************
// color.fx by Frank Luna (C) 2011 All Rights Reserved.
//
// Transforms and colors geometry.
//***************************************************************************************

cbuffer cbPerObject
{
    float4x4 gWorldViewProj; 
};

struct VertexIn
{
    float3 PosL  : POSITION;
    float4 Color : COLOR;
};

struct VertexOut
{
    float4 PosH  : SV_POSITION;
    float4 Color : COLOR;
};

VertexOut VS(VertexIn vin)
{
    VertexOut vout;

    // Transform to homogeneous clip space.
    vout.PosH = mul(float4(vin.PosL, 1.0f), gWorldViewProj);

    // Just pass vertex color into the …
Run Code Online (Sandbox Code Playgroud)

c++ directx shader hlsl visual-studio-2013

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

错误:限定符在类型x的绑定引用中删除到类型为y的初始化程序

为什么以下抛出此错误:

IntelliSense:限定符在"string&"类型的绑定引用中删除到"const string"类型的初始化程序

.H

class A
{
public:
    wstring& GetTitle() const;
private:
    wstring title;    
};
Run Code Online (Sandbox Code Playgroud)

的.cpp

wstring& GetTitle() const
{
    return this->title;
}
Run Code Online (Sandbox Code Playgroud)

如果我删除const字,它会停止抱怨,但我从未对变量进行任何更改?

c++

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

来自NuGet的Unity Bootstrapper在App_Start上抛出错误

用于Unity 3.0的Microsoft Unity Bootstrapper在此行上引发错误:

FilterProviders.Providers.Add(new UnityFilterAttributeFilterProvider(container));
Run Code Online (Sandbox Code Playgroud)

出现以下错误:

mscorlib.dll中出现"System.ArrayTypeMismatchException"类型的异常,但未在用户代码中处理

附加信息:尝试将元素作为与阵列不兼容的类型进行访问.

整个代码都在这里,这是由nuget下载的bootstrapper预先制作和编写的.

Bootstrapper生成的文件App_Start/UnityMVCActivator.cs

using System.Linq;
using System.Web.Mvc;
using Microsoft.Practices.Unity.Mvc;

[assembly: WebActivatorEx.PreApplicationStartMethod(typeof(WebApplication.WebUI.App_Start.UnityWebActivator), "Start")]

namespace WebApplication.WebUI.App_Start
{
    /// <summary>Provides the bootstrapping for integrating Unity with ASP.NET MVC.</summary>
    public static class UnityWebActivator
    {
        /// <summary>Integrates Unity when the application starts.</summary>
        public static void Start() 
        {
            var container = UnityConfig.GetConfiguredContainer();

            FilterProviders.Providers.Remove(FilterProviders.Providers.OfType<FilterAttributeFilterProvider>().First());
            FilterProviders.Providers.Add(new UnityFilterAttributeFilterProvider(container));

            DependencyResolver.SetResolver(new UnityDependencyResolver(container));

            // TODO: Uncomment if you want to use PerRequestLifetimeManager
            // Microsoft.Web.Infrastructure.DynamicModuleHelper.DynamicModuleUtility.RegisterModule(typeof(UnityPerRequestHttpModule));
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

Bootstrapper生成的文件App_Start/UnityConfig.cs

using System;
using Microsoft.Practices.Unity;
using Microsoft.Practices.Unity.Configuration; …
Run Code Online (Sandbox Code Playgroud)

c# unity-container visual-studio-2013 asp.net-mvc-5

9
推荐指数
1
解决办法
6713
查看次数

如何使用PHPExcel冻结标题和一组列

我想冻结我的页眉和列,如下所示:

在此输入图像描述

我可以冻结我的标题绝对精细和花花公子:

    $highestRowCount = $sheet->getHighestRow();
    $highestColumnCount = $sheet->getHighestColumn();

    $sheet->freezePane( "{$highestColumnCount}2" );
Run Code Online (Sandbox Code Playgroud)

但是当我在列上添加另一个冻结时:

    $sheet->freezePane( "D{$highestRowCount}" );
Run Code Online (Sandbox Code Playgroud)

它打破了擅长滚动的能力......

我该怎么做呢?

php phpexcel

9
推荐指数
1
解决办法
7911
查看次数

你能迭代一个雄辩的对象的属性吗?

如果我有例如:

$project = new Project(); // Project is a class that extends Eloquent
$project->title;
$project->something;
Run Code Online (Sandbox Code Playgroud)

是否有可能迭代这些属性......像这样:

foreach( $project as $key => $value )
{
    echo $key;
}
Run Code Online (Sandbox Code Playgroud)

我正在尝试这样做,以实现编辑Eloquent模型的工作单元

php unit-of-work laravel eloquent

9
推荐指数
2
解决办法
5683
查看次数

无法为数组指定显式初始值设定项

我收到以下编译错误...

error C2536: 'Player::Player::indices' : cannot specify explicit initializer for arrays 
Run Code Online (Sandbox Code Playgroud)

为什么是这样?

class Player
{
public:
    Player();
    ~Player();

    float x;
    float y;
    float z;
    float velocity;

    const unsigned short indices[ 6 ];
    const VertexPositionColor vertices[];
};
Run Code Online (Sandbox Code Playgroud)

CPP

Player::Player()
:
    indices
    { 
        3, 1, 0,
        4, 2, 1 
    },
    vertices{
        { XMFLOAT3( -0.5f, -0.5f, -0.5f ), XMFLOAT3( 0.0f, 0.0f, 0.0f ) },
        { XMFLOAT3( -0.5f, 0.5f, -0.5f ), XMFLOAT3( 0.0f, 0.0f, 1.0f ) },
        { XMFLOAT3( 0.5f, -0.5f, -0.5f ), …
Run Code Online (Sandbox Code Playgroud)

c++ visual-studio-2013

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

当单元格等于字符串时,PHPExcel条件格式

下列:

$objConditional1 = new PHPExcel_Style_Conditional();
$objConditional1->setConditionType(PHPExcel_Style_Conditional::CONDITION_CONTAINSTEXT)
                ->setOperatorType(PHPExcel_Style_Conditional::OPERATOR_CONTAINSTEXT)
                ->addCondition("Bla bla");
$objConditional1->getStyle()->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID)->getEndColor()->setARGB(PHPExcel_Style_Color::COLOR_GREEN);   


$conditionalStyles = $sheet->getStyle('I2')->getConditionalStyles();
array_push($conditionalStyles, $objConditional1);               
$sheet->getStyle('I$2:I$10000')->setConditionalStyles($conditionalStyles);
Run Code Online (Sandbox Code Playgroud)

生成一个excel文档,并说条件格式有问题,它将删除它...

我正在寻找的正确结果是当列等于"Bla bla"时填充绿色框

php phpexcel

7
推荐指数
1
解决办法
7471
查看次数