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) 我的外键与它自己的表有关.这是为了生成具有层次结构的帖子.
现在当我尝试删除数据库中的列时,它给了我这个错误:
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并删除外键本身.然后放下列.
我有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)
我该怎么做呢?
我正在关注一本名为" 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) 为什么以下抛出此错误:
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字,它会停止抱怨,但我从未对变量进行任何更改?
用于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) 我想冻结我的页眉和列,如下所示:

我可以冻结我的标题绝对精细和花花公子:
$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)
它打破了擅长滚动的能力......
我该怎么做呢?
如果我有例如:
$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模型的工作单元
我收到以下编译错误...
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) 下列:
$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"时填充绿色框