小编Ale*_*lex的帖子

将TimeSpan从格式"hh:mm:ss"转换为"hh:mm"

我想在TextBox中只显示小时和分钟

var test = dataRow.Field<TimeSpan>("fstart").ToString();  
//test ="08:00:00"  
var tb = (TextBox) gridViewRow.Cells[2].FindControl("fstart");
tb.Text = test;
Run Code Online (Sandbox Code Playgroud)

如何只显示小时和分钟 "hh.mm"

c# asp.net textbox timespan

37
推荐指数
3
解决办法
8万
查看次数

更改引导DateTimePicker的语言

我使用bootstrap-datetimepicker.jsStefan Petre的2012版权所有

http://www.malot.fr/bootstrap-datetimepicker/index.php

我导入js和另一种语言,例如俄语:

<script type="text/javascript" 
  src="/Resources/plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.js"></script>
<script type="text/javascript" 
  src="/Resources/plugins/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.ru.js" charset="UTF-8"></script>
Run Code Online (Sandbox Code Playgroud)

在document.ready

$(document).ready(function () {
    // debugger;

    $(".form_datetime").datetimepicker({
        isRTL: false,
        format: 'dd.mm.yyyy hh:ii',
        autoclose:true
    });
});
Run Code Online (Sandbox Code Playgroud)

但它没有翻译

我试图在init上插入

**language: "RU"**
**language: "ru"**
**language: "ru-RU"**
Run Code Online (Sandbox Code Playgroud)

但没有变化,你有任何建议吗?

javascript translate twitter-bootstrap smalot-datetimepicker

35
推荐指数
7
解决办法
19万
查看次数

与Newtonsoft.Json的装配冲突

我需要在我的配置文件中加载2个版本的程序集Newtonsoft.Json vesion 4.0.8.0和4.5.0.0:

<dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.8.0" newVersion="4.0.8.0" />
</dependentAssembly>
Run Code Online (Sandbox Code Playgroud)

但我需要旧4.0.8.0和新的4.5.0.0

  <dependentAssembly>
        <assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.8.0" newVersion="4.5.0.0" />
      </dependentAssembly>
Run Code Online (Sandbox Code Playgroud)

我从Package Console安装了最新版本,但它给了我错误:

错误80无法加载文件或程序集'Newtonsoft.Json,Version = 4.5.0.0,Culture = neutral,PublicKeyToken = 30ad4fe6b2a6aeed'或其依赖项之一.定位的程序集的清单定义与程序集引用不匹配.(HRESULT异常:0x80131040)

.net json.net .net-assembly

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

将DateTimeOffset转换为DateTime并将偏移量添加到此DateTime

我有DateTimeOffset:

    DateTimeOffset myDTO = DateTimeOffset.ParseExact(
                      "2015/01/15 17:37:00 -0500", "yyyy/MM/dd HH:mm:ss zzz", 
                      CultureInfo.InvariantCulture); 
Console.WriteLine(myDTO);
Run Code Online (Sandbox Code Playgroud)

// result => "1/15/2015 17:37:00 -05:00"

如何转换为DateTime并在结果DateTime中添加此偏移量"-0500"

// desired result =>" 1/15/2015 22:37:00 "

c# datetime datetimeoffset

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

无法加载文件或程序集'Autofac,Version = 3.0.0.0

我正在尝试使用此连接器enFinder文件管理器连接到我的asp.net项目.我添加了Autofac版本3.之后我删除了引用并添加了对Autofac 2.6的引用.现在出现以下错误:

无法加载文件或程序集'Autofac,Version = 3.0.0.0,Culture = neutral,PublicKeyToken = 17863af14b0044da'或其依赖项之一.定位的程序集的清单定义与程序集引用不匹配.(HRESULT异常:0x80131040)

我该如何解决这个问题?

asp.net autofac

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

找不到类型库"Microsoft.Office.Core"的包装程序集

我在Visual Studio中构建项目时收到警告:

Cannot find wrapper assembly for type library "Microsoft.Office.Core" 
Run Code Online (Sandbox Code Playgroud)

我怎么摆脱它?

warnings ms-office visual-studio-2010

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

Jquery:不推荐使用属性的指定属性.它总是返回true

我有选择元素的集合,当我第一次更改一个选择元素的值时,此功能不起作用,它第二次更改值时工作,在控制台中我有 这个

jQuery代码:

$(document).ready(function () {
    var collection = $('select.ddlJ');
    console.log(collection);
    for (var element in collection) {
        $(element).change(function () {

            $('select.ddlJ').change(function (e) {
                $(this).parent().parent().find('td:last').prev().find('span').html(
                    $(this).parent().parent().find('select.ddlJ').filter(function () {
                        return $.trim($(this).val()) == 'm';
                    }).length);

                $(this).parent().parent().find('td:last span').html(
                $(this).parent().parent().find('select.ddlJ').filter(function () {
                    return $.trim($(this).val()) == 'n'; }).length);
            });
        });
    }
});
Run Code Online (Sandbox Code Playgroud)

HTML代码:

<table cellspacing="0" border="1" style="border-collapse:collapse;" id="grid1"
   rules="all">
        <tbody><tr>
 <th scope="col">Nr de ord</th>
 <th scope="col">StudentId</th>
 <th scope="col">Name LName</th>

 <th scope="col">
      <span id="mondayText">monday<br></span>
      <span id="monday">14.05.2012</span>
  </th>
<th scope="col">
     <span id="thuesdayText">thuesday<br></span>
     <span id="thuesday">15.05.2012</span>
</th>
<th scope="col">
     <span id="wednesdayText">wednesday<br></span> …
Run Code Online (Sandbox Code Playgroud)

javascript jquery onchange

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

从下拉列表中的datatextfield中的数据表中合并2列

var id = Session["staff_id"].ToString()

//I have datatable with 5 columns

DataTable dt = function_return_Datatable(id);

dropdownlist1.DataSource = dt;

/*in DataTextField I want to merge two columns of DataTable, dt.columns [1] is First Name and dt.columns [2] is LastName*/

//I tried this way to merge them, but no results
dropdownlist1.DataTextField = dt.Columns[1].ToString()+" "+dt.Columns[2].ToString();

dropdownlist1.DataValueField = dt.Columns[0].ToString();
dropdownlist1.DataBind();
Run Code Online (Sandbox Code Playgroud)

有关如何合并这两列的任何想法?

.net c#

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

如何使用open xml sdk从c#更改页面方向

我正在创建一个word文档

using (WordprocessingDocument myDoc = WordprocessingDocument.Create(@"c:\generate\export.docx", WordprocessingDocumentType.Document))          
{
    MainDocumentPart mainPart = myDoc.AddMainDocumentPart(); 
    mainPart.Document = new Document();               
    var body = new Body();               
    var p = new Paragraph(
        new ParagraphProperties(
            new Justification()
            {
                Val = JustificationValues.Center
            }
        ),
        new Run(new Text("test"))
    ); 
    body.Append(p);                
    mainPart.Document.Append(body);                
    // Save changes to the main document part.                 
    mainPart.Document.Save();
}
Run Code Online (Sandbox Code Playgroud)

如何将页面方向设置为横向

c# openxml export-to-word

6
推荐指数
1
解决办法
5172
查看次数

using namespace指令只能应用于名称空间

using System.Text.RegularExpressions;
using System.DateTime; 

DateTime returnedDate = DateTime.Now();
Run Code Online (Sandbox Code Playgroud)

它给我错误:

A using namespace directive can only be applied to namespaces; 
'System.DateTime' is a type not a namespace (line 1, pos 1)
Run Code Online (Sandbox Code Playgroud)

我的错在哪里?

.net c# datetime

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