我正在考虑在我的应用程序中添加一个时间选择器,并发现:
<label for="appt">Choose a time for your meeting:</label>
<input type="time" id="appt" name="appt" min="09:00" max="18:00" required>
<small>Office hours are 9am to 6pm</small>Run Code Online (Sandbox Code Playgroud)
我想要的是仅显示 15 分钟间隔的分钟。所以 00、15、30 和 45。
阅读文档后,输入类型有一个属性调用 Step:
步骤属性是一个数字,指定值必须遵循的粒度,或者特殊值any,如下所述。只有等于步进基础的值(如果指定了最小值,否则为值,如果两者都没有提供,则为适当的默认值)才有效。
所以我把它设置为900(60*15),但它仍然不限制选择。
有人给我一些建议吗?
我正在使用SoapUI来测试将由Java客户端应用程序使用的.Net Web服务.
当我将我的Web服务连接到SoapUI但更新WSDL位置并调用其中一个预设测试脚本时,Web服务失败并显示以下代码
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<soap:Fault>
<faultcode>soap:Client</faultcode>
<faultstring>System.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction: urn:mycode:us:gu:das:supplierengagement:v02:SupplierEngagement:/AppointSupplier.
at System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouteRequest()
at System.Web.Services.Protocols.SoapServerProtocol.RouteRequest(SoapServerMessage message)
at System.Web.Services.Protocols.SoapServerProtocol.Initialize()
at System.Web.Services.Protocols.ServerProtocolFactory.Create(Type type, HttpContext context, HttpRequest request, HttpResponse response, Boolean& abortProcessing)
</faultstring>
<detail/>
</soap:Fault>
</soap:Body>
</soap:Envelope>
Run Code Online (Sandbox Code Playgroud)
从上面的错误可以看出,问题在于SOAPAction参数有一个额外的正斜杠.
我在类上使用以下属性:
<WebService(Namespace:= "urn:mycode:us:gu:das:supplierengagement:v02:SupplierEngagement:AppointSupplier")>
Run Code Online (Sandbox Code Playgroud)
以及方法调用的以下属性:
<WebMethod(MessageName:="appointSupplierRq")>
Run Code Online (Sandbox Code Playgroud)
从这些,.Net正在添加正斜杠.
必须可以删除自动生成的正斜杠.
我知道这已经被问过多次了。但是到目前为止,我还没有找到可行的解决方案。
我在视图中有以下代码:
@using (Html.BeginForm("RoleEdit", "AccountRoles", FormMethod.Post, new { id = "updaterole" }))
{
<button name="mySubmit" formaction="@Url.Action("SetDefaultRole", "AccountRoles")" value="MakeDefault" class="button small">Make Default</button>
...
other code
...
<button type="submit" class="button small" value="save" name="save" id="save">@Resources.DashBoardTags.UpdateRoleTag</button>
}
Run Code Online (Sandbox Code Playgroud)
并在控制器中:
[HttpPost]
public ActionResult SetDefaultRole()
{
return View();
}
Run Code Online (Sandbox Code Playgroud)
和:
[HttpPost]
public ActionResult RoleEdit(List<UserRole> userRole, string mySubmit)
{
if (mySubmit == "Save Draft")
{
//save draft code here
}
else if (mySubmit == "Publish")
{
//publish code here
}
}
Run Code Online (Sandbox Code Playgroud)
当代码执行时:
当单击第一个提交按钮时,它将忽略SetDefaultRole函数并执行RoleEdit函数。
RoleEdit函数的值mySubmit为空。
请向我展示我的方式的错误!!!
我看了建议的解决方案:建议的解决方案
由此,我创建了一个名为MultipleButton的属性扩展,并更改了代码,以使代码现在看起来像这样: …
我有一个用c#编写的DLL工作正常(它正在做的事情没有任何后果).
然后我尝试从VB6调用.
一切都很顺利.
当我更改c#代码以使用app.config存储配置数据时,VB6代码失败.
现在我知道.Net中的DLL从调用应用程序中查找app.config,但是VB6没有这个.
这是我必须忍受的东西,还是有另一种方式?
关于 Automapper 的快速新手问题。
我有以下代码:
CreateMap<MyDataContract, MyViewModel>()
.MapFrom(s => s.Trans, d => d.Trans);
Run Code Online (Sandbox Code Playgroud)
在 DataContract MyDataContract 中,我有以下内容:
[DataMember]
public IEnumerable<ReferTypeDataContract> Refer { get; set;}
Run Code Online (Sandbox Code Playgroud)
我试图找出 Automapper 如何将其从上述 CreateMap 映射到 ReferTypeDataContract。是否有任何可视化工具来检查这一点,或者可以添加一些调试代码以使其可见。
我问的原因是我有一个不同的映射来映射 MyDataContract,但是我得到了一组不同的引用列表结果,无法弄清楚。
我在 MVC 版本 5 中遇到自定义验证问题。
我有下面的代码作为验证器。
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Web.Mvc;
namespace PortalWebsite.Common
{
[AttributeUsage(AttributeTargets.Property, AllowMultiple = false)]
public class GreaterThanAttribute : ValidationAttribute, IClientValidatable
{
public string OtherPropertyName { get; private set; }
public bool AllowEquality { get; private set; }
public GreaterThanAttribute(string otherPropertyName, bool allowEquality = true)
{
AllowEquality = allowEquality;
OtherPropertyName = otherPropertyName;
}
protected override ValidationResult IsValid(object value, ValidationContext validationContext)
{
var result = ValidationResult.Success;
var otherValue = validationContext.ObjectType.GetProperty(OtherPropertyName)
.GetValue(validationContext.ObjectInstance, null);
if (value != …Run Code Online (Sandbox Code Playgroud) 我有以下 Linq,我认为它在语法上是正确的。
var result = from t1 in context.t1
join t2 in context.t2
on new { t1.field1, t1.field2 } equals new { t2.field1, t2.field2 }
select new { t1, t2 };
Run Code Online (Sandbox Code Playgroud)
但我收到以下错误:
CS1941 The type of one of the expressions in the join clause is incorrect. Type inference failed in the call to 'Join'.
Run Code Online (Sandbox Code Playgroud)
经过检查数据库,我发现以下内容:
table1 | table2
|
field1 varchar(16) | field1 varchar(50)
field2 varchar(30) | field2 varchar(50)
Run Code Online (Sandbox Code Playgroud)
字段数据类型和长度应该匹配吗?
我有一个ViewModel,它有一个属性,定义为Division类型的IList.Division对象如下:
public class DivisionViewModel :
{
public int Id { get; set; }
public int DivisionId { get; set; }
public string Name { get; set; }
}
Run Code Online (Sandbox Code Playgroud)
过去,我刚刚在视图中创建了以下内容:
<div class="divisions">
@for (int i = 0; i < Model.Divisions.Count(); i++)
{
@Html.Hidden(Model.Divisions[i].DivisionId.ToString(), new { @name = "Divisions[" + i + "].DivisionId", @id = "Divisions_" + i + "__.DivisionId" })
@Html.Hidden(Model.Divisions[i].Id.ToString(), new { @name = "Divisions[" + i + "].Id", @id = "Divisions_" + i + "__.Id" })
@Html.Hidden(Model.Divisions[i].Name, new { …Run Code Online (Sandbox Code Playgroud) c# ×6
asp.net-mvc ×3
.net ×1
asp.net ×1
automapper ×1
dll ×1
html ×1
javascript ×1
linq ×1
linq-to-sql ×1
soap ×1
soap-client ×1
validation ×1
vb.net ×1
vb6 ×1
web-services ×1