小编Jor*_*rge的帖子

使用编辑器模板处理可空类型

我开发了一个编辑器模板,它采用布尔类型并创建一个下拉列表,将truefalse默认值更改为SiNo.现在,当我部署应用程序时,我没有意识到booleanNullable<boolean>我的编辑器模板(boolean.cshtml)的名称相同并受到影响.现在我不想要这个,我想修改它的行为editorfor,只有当模型的数据类型Nullable<boolean>不是它的布尔值时.我怎么能处理这个?

 @model Nullable<bool>

@{
    var listItems = new[]
    {
        new SelectListItem { Value = "true", Text = "Si" },
        new SelectListItem { Value = "false", Text = "No" }
    };  

}


@Html.DropDownListFor( model => model.Value, listItems)
Run Code Online (Sandbox Code Playgroud)

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

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

如何在css2中为chrome浏览器添加文本闪烁效果

text-decoration:blink在我的css代码中设置了这个css属性.不幸的是它只适用于Firefox.必须有一种方法来显示克罗姆的闪烁效果.你们必须有答案..

css

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

使用地图网络应用程序google-maps与bing-maps开发的最佳API

我需要开发和使用地图的Web应用程序,我有两个选项来实现目标.谷歌地图或bing地图,我担心这是更好的女巫

  1. 文档非常重要
  2. 使用.net开发Web应用程序
  3. 快速学习曲线

我需要建议,因为我的观点都是一个完整的工具来解决我的问题.谢谢

maps google-maps bing-maps

3
推荐指数
1
解决办法
2358
查看次数

在信息窗口中添加事件处理程序元素google maps v3

嗨,我正在尝试添加到信息窗口内的按钮,我尝试这样的事件

var infoWindow = new google.maps.InfoWindow({
    content: '<div></br><span class="formatText">Ubicacion del Marcador: </span>' + event.latLng.toString() 
            + '</br> <input type="button" id="btnPrueba" value="prueba"/></div>'
});

google.maps.event.addListener(marker, 'click', function () {
    infoWindow.open(map, this);
    google.maps.event.addDomListener(document.getElementById('btnPrueba'), 'click', removeMarker);
});

function removeMarker(){

    alert('it works');
}
Run Code Online (Sandbox Code Playgroud)

我究竟做错了什么?或者这是另一种方法吗?谢谢

编辑

我也试过像这样的jquery但是虽然事件是通过函数得到的警报没有显示.当我使用chrome进行调试时,它的工作原理:(

google.maps.event.addListener(marker, 'click', function () {
    infoWindow.open(map, this);
    $("#btnPrueba").click(function () {

        alert('funciona');
    });
});
Run Code Online (Sandbox Code Playgroud)

javascript jquery infowindow google-maps-api-3

3
推荐指数
1
解决办法
6208
查看次数

在html中获取我的服务器的根路径

它很简单,但有点难以解释.我有这个形象

<img src="../../Image/Picture.JPG" />
Run Code Online (Sandbox Code Playgroud)

但我不想使用../..我只是想知道它是否是一个带到根文件夹的符号.完成这样的事情.换句话说,我正在寻找一个让我成为部署html根源的角色

<img src="rootFolder/Image/Picture.JPG" />
Run Code Online (Sandbox Code Playgroud)

我也试过这样,但它不起作用

<img src="~/Image/Picture.JPG" />
Run Code Online (Sandbox Code Playgroud)

html redirect

3
推荐指数
1
解决办法
7867
查看次数

比较字符串的最佳做法

可能重复:
string.Equals()和==运算符是否真的相同?

我知道在c#中你可以将字符串与==和equals进行比较,但我想知道根据最佳实践我需要使用什么.请注意,我需要知道String和string是否相同

c#

3
推荐指数
1
解决办法
5009
查看次数

使用命令aspnet_regiis.exe加密web.config

我的网络配置如下

<?xml version="1.0"?>
<configuration>
<appSettings/>
<connectionStrings>
      <add name="MySqlConnection" connectionString="Data Source=server;Initial    Catalog=BD;User Id=usr; Password=psswd" />
</connectionStrings>
<system.web>
    <!--<authentication mode="Forms" />-->
    <roleManager enabled="true" />
    <compilation debug="true" targetFramework="4.0">
        <assemblies>
            <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
            <add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            <!--add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>-->
        </assemblies>
    </compilation>

    <authentication mode="Forms">
        <forms loginUrl="login.aspx" name=".ASPXFORMSAUTH"/>
    </authentication>
    <authorization>
        <deny users="?" />
    </authorization>


    <membership defaultProvider="SqlProvider" userIsOnlineTimeWindow="15">
        <providers>
            <clear />
            <add
  name="SqlProvider"
  type="System.Web.Security.SqlMembershipProvider"
  connectionStringName="MySqlConnection"
  applicationName="/"
  enablePasswordRetrieval="false"
  enablePasswordReset="true"
  requiresQuestionAndAnswer="true"
  requiresUniqueEmail="true"
  passwordFormat="Hashed" />
        </providers>
    </membership>

    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/></system.web>
<system.codedom>
</system.codedom>

<system.webServer>
</system.webServer> …
Run Code Online (Sandbox Code Playgroud)

c# encryption web-config

3
推荐指数
1
解决办法
3073
查看次数

以编程方式构建C#解决方案

可能重复:
如何在C#中以编程方式构建解决方案?

有一种方法可以通过API或库从c#代码构建解决方案.

因为我只是通过此链接中的命令行找到了该怎么做

c# asp.net

3
推荐指数
1
解决办法
423
查看次数

修改布尔类型的MVC默认行为

我定义了这个editorTemplate来修改boolean类型的行为,我的问题是当类型可以为空时我想创建一个组合来改变默认值,到我想要的,但我不知道如何选择值来自模特.

例如,如果值是,true我希望使用SIvalue 选择下拉列表,使用false NO.现在,我知道我可以得到这样的模型的价值,Model.Value但我不知道如何根据模型传递到选择列表.这是我的editorTemplate

@model Nullable<bool>

@{
    var listItems = new[]{
        new SelectListItem { Value = "null", Text = "Sin Valor" },
        new SelectListItem { Value = "true", Text = "Si" },
        new SelectListItem { Value = "false", Text = "No"}
    };
}

@if (ViewData.ModelMetadata.IsNullableValueType)
{

    @Html.DropDownList("", listItems)
}
else
{
    @Html.CheckBox("", ViewData.Model.Value)
}
Run Code Online (Sandbox Code Playgroud)

c# razor asp.net-mvc-3

3
推荐指数
1
解决办法
747
查看次数

Url.RouteUrl正在添加错误的字符

这是我的mvc3应用程序的路由配置

routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

 routes.MapRoute(
    "Default", // Route name
    "{controller}/{action}/{id}", // URL with parameters
    // Parameter defaults:
    new { controller = "Home", action = "Index", id = UrlParameter.Optional } 
 );
Run Code Online (Sandbox Code Playgroud)

正如您所看到的,这是mvc3应用程序的默认路由,您可以注意到我根本没有更改它.所以当我试图RouteUrl像这样使用url helper时

@Url.RouteUrl("Default", 
              new { Action = "RegistrarPago", 
                    IDPago = ViewBag.IDPago,
                    confirmNumber = ViewBag.ConfirmationNumber }, 
              Request.Url.Scheme)
Run Code Online (Sandbox Code Playgroud)

输出就是这个

http://localhost/DescuentoDemo/pago/RegistrarPago?IDPago=60&amp;confirmNumber=1798330254

这个url基本上对于这个字符amp;是错误的帮助器有什么问题我假设这是一个编码问题,但为什么呢?

c# asp.net-mvc-3

3
推荐指数
1
解决办法
1352
查看次数