小编mhu*_*mhu的帖子

如何在ASP.NET下拉列表中添加选项组?

我需要在ASP.NET下拉服务器控件中对下拉列表选项进行分组.你对如何处理这个问题有任何想法吗?我是ASP.NET的新手.

我的要求.

c# asp.net

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

unwrapObservable和()之间的区别

两者之间是否存在实际差异:

y = ko.observable("value");
x = ko.utils.unwrapObservable(y);
Run Code Online (Sandbox Code Playgroud)

和:

y = ko.observable("value");
x = y();
Run Code Online (Sandbox Code Playgroud)

我应该更喜欢上述之一吗?为什么?

knockout.js

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

OData过滤器选项(处理null或空值)

我们在OData中使用$ filter system query选项来执行过滤器值在运行时发送的过滤器.

作为一个例子,OData URL将是这样的:

http://services.odata.org/Northwind/Northwind.svc/Customers?$ filter = CustomerID eq @InCustomerID和Country eq @InCountry

其中@InCustomerID和@InCountry是等于过滤器的输入值.

在运行时,当用户为客户ID输入一些值(比如说'ABCD')时,我们会用'ABCD'替换@InCustomerID

在运行时,查询将如下所示:

http://services.odata.org/Northwind/Northwind.svc/Customers?$ filter = CustomerID eq'ABCD'和Country eq'US'

在上述情况下,用户输入了以下值:CustomerID =>'ABCD'和Country =>'US'

我的问题是关于在OData $ filter中处理空值.如果用户没有为CustomerID输入任何值,那么我们要选择来自特定国家/地区的所有客户.

在sql的情况下,这将是这样的:

select*from Customers where((CustomerID = @InCustomerID)或(@CustomerID为null))和(Country = @Country).

本质上,如何处理null或空值,以便逻辑条件中的特定谓词始终为true.

OData过滤是否启用此选项?

odata

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

用简单的英语,什么是Django通用视图?

本页的前两段解释了通用视图应该让我的生活更轻松,更少单调,让我对女性更具吸引力(我构成了最后一个):

https://docs.djangoproject.com/en/1.4/topics/generic-views/

我都是为了改善我的生活,但通用观点实际上做了什么?似乎有很多流行语被抛出,这比他们解释的更令人困惑.

通用视图类似于Ruby on Rails中的scaffolding吗?介绍中的最后一个要点似乎表明了这一点.这是一个准确的陈述吗?

python django django-generic-views

20
推荐指数
2
解决办法
6259
查看次数

在另一个ng-repeat中使用ng-repeat

我正在开发一个页面,我需要显示一些ng-repeat包含频道信息的框(使用)以及它将在何处显示(哪些是城市).

我面临的问题是当我重复第二个问题时ng-repeat:

<table class="table table-condensed" ng-init="nitsCh = [objsCh[$index].nit]">
Run Code Online (Sandbox Code Playgroud)

这应该得到第一个ng-repeat的$ index并创建一个新的数组,其中显示了通道的位置.它确实如此.但是,当我使用此数组应用第二个ng-repeat时,它无法正常工作.

说我的html看起来像这样(PS:我需要使用索引值而不是objCh.name因为我将这些框放入列中)

<div class="box box-solid box-default" ng-repeat="(indexO, objCh) in objsCh track by indexO" ng-if="indexO%4==0  && indexO<=10">
  <div class="box-header"> 
    <div class="pull-left"> 
      <img src="dist/img/channels/{{ objsCh[indexO].pic }}" data-toggle="tooltip" title="" data-original-title="Alterar logo do canal"> 
      <h3 class="box-title">{{ objsCh[(indexO)].name }}</h3> 
    </div> 
    <div class="box-tools pull-right"> 
      <button class="btn btn-box-tool" data-toggle="tooltip" title="" data-original-title="Adicionar ou Remover NIT"><i class="fa fa-plus"></i></button> 
    </div> 
  </div> 
  <div class="box-body"> 
    <table class="table table-condensed" ng-init="nitsCh = [objsCh[indexO].nit]"> 
      <tbody> 
        <tr> 
          <th style="width: 10px">#</th> 
          <th>Nit</th> …
Run Code Online (Sandbox Code Playgroud)

javascript angularjs angularjs-ng-repeat

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

信号器不调用客户端功能

我正在使用带有Signalr 1.0.0软件包的VS2012"Fall"更新.调用服务器端功能正常.但是不调用客户端功能.当onBroadcastMessage()调用(见下文)时似乎没有任何事情发生.

问题:

  • 我错过了什么?
  • 有没有办法调试客户端调用?

谢谢!

服务器代码:

using Microsoft.AspNet.SignalR;

namespace KPMain
{
    public class RealtimeConnectionHub : Hub
    {
        public void BroadcastMessage(string name, string message) {
            Clients.All.onBroadcastMessage(name, message);
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

路线登记:

public class RouteConfig
{
    public static void RegisterRoutes(RouteCollection routes) {
        HubConfiguration hubConfig = new HubConfiguration();
#if DEBUG
        hubConfig.EnableDetailedErrors = true;
#endif
        routes.MapHubs(hubConfig);

        ...
    }
}
Run Code Online (Sandbox Code Playgroud)

客户代码(简化):

var rtcom = new RealtimeConnection();
rtcom.init({debug: true}, function () {
    rtcom.subscribe(function (sender, message) {
        if (message) {
            alert("message");
        }
    });
}); …
Run Code Online (Sandbox Code Playgroud)

signalr signalr-hub

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

如何使TFS 2015中的PowerShell任务失败

我试图在PowerShell脚本中使某个结果在构建过程中失败,但它对我不起作用.我正在使用TFS 2015中的新构建操作并尝试以下选项:

我确实在步骤的日志窗口中获得了红色文本,并在构建概述中标记了"问题",但构建结果仍为绿色:"构建成功"

我想使用脚本中的失败来使构建失败,从而使用失败构建的警报发送电子邮件.

编辑:包括PS脚本:

Param(
  [string]$url
)

if ($url -eq '')
{
    #use default value
    $url = 'https://myurl.com'
}

$req = [system.Net.WebRequest]::Create($url)
$req.Timeout = 60000 * 5 # = 5 minutes
try
{
    Write-Host "Try to get response from url:" $url
    $res = $req.GetResponse()
    Write-Host "Closing the connection"
    $req.Close() # close the connection
} 
catch [System.Net.WebException] 
{
    Write-Host "Got an exception"    
    Write-Host "##vso[task.logissue type=error;]Exception: " $_.Exception

    if ($_.response) # try to close the connection
    {
        $_.response.Close();    
    } …
Run Code Online (Sandbox Code Playgroud)

powershell tfs-2015

12
推荐指数
1
解决办法
8876
查看次数

在C中,当我在另一个文件中声明不同数据类型的全局变量时,为什么不出错?

我试过以下代码:

FILE1.C:

int x;
Run Code Online (Sandbox Code Playgroud)

file2.c中:

extern char x;
main()
{
    x=10;
    ....
    ....
}
Run Code Online (Sandbox Code Playgroud)

编译为

$ gcc File1.c File2.c

我没有得到任何错误,但我期待一个.

c extern

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

IIS 7.5, Web Service and HTTP 405 error

I have a web service which I host on my machine. I use Windows 7 and IIS 7.5.

Problem: When the client tries to consume the web service, he/she gets a HTTP 405 error.

In the log file of IIS, I can see that this is refused because POST verb is not allowed.

问题:如何为这些请求允许POST动词?
我是否必须添加WSDL文件的映射?如果我这样做,我该如何配置此映射?我检查过,在现有的映射中,我没有WSDL扩展.

是否可能在IIS上设置另一个允许这些请求的东西?

Web服务是使用WCF构建的.

c# iis wcf http-post

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

gridview数据导出到asp.net中的excel

我试图将网格视图数据传输到excel ....但输出是一个空白的Excel工作表.如何解决这个问题?是否有任何代码将网格视图值传输到带有数据库的Excel工作表?

protected void btnexcel_Click1(object sender, EventArgs e)
{
    Response.Clear();
    Response.Buffer = true;
    Response.AddHeader("content-disposition", "attachment;filename=GridViewExport.xls");
    Response.Charset = "";
    Response.ContentType = "application/vnd.ms-excel";

    StringWriter sw = new StringWriter();
    HtmlTextWriter hw = new HtmlTextWriter(sw);

    gvdetails.AllowPaging = false;
    gvdetails.DataBind(); 
    gvdetails.HeaderRow.Style.Add("background-color", "#FFFFFF");
    gvdetails.HeaderRow.Cells[0].Style.Add("background-color", "green");
    gvdetails.HeaderRow.Cells[1].Style.Add("background-color", "green");
    gvdetails.HeaderRow.Cells[2].Style.Add("background-color", "green");
    for (int i = 0; i < gvdetails.Rows.Count;i++ )
    {
        GridViewRow row = gvdetails.Rows[i];
        row.BackColor = System.Drawing.Color.White;
        row.Attributes.Add("class", "textmode");
        if (i % 2 != 0)
        {
            row.Cells[0].Style.Add("background-color", "#C2D69B");
            row.Cells[1].Style.Add("background-color", "#C2D69B");
            row.Cells[2].Style.Add("background-color", "#C2D69B");
        }
    }

    string style = …
Run Code Online (Sandbox Code Playgroud)

c# asp.net excel

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