public ActionResult addstandardpackage1(ICollection<int> SingleStay,ICollection<int> DOUBLESTAY,ICollection<int> TRIBLESTAY,ICollection<int> FAMILYSTAY,ICollection<int> EXTRABED)
{
var s = SingleStay;
for (int i = 0; i < SingleStay.Count; i++ )
{
var cal = SingleStay[i];
}
foreach (var key in SingleStay)
{
var value = key;
}
}
Run Code Online (Sandbox Code Playgroud)
在for循环中,我得到的错误就像无法将带有[]的索引应用于类型的表达式但是我需要for for循环,对于我得到的每一个.因为基于for循环我会将细节与其他集合列表绑定.请帮我.
我收到了错误var cal=Singlestay[i].
我有一个简单的Web方法和ajax调用,并继续收到一个错误,说它无法将字符串转换为IDictionary对象???
这是ajax调用:
var params = '{"ID":"' + rowid + '"}';
$.ajax({
url: 'EDI.asmx/GetPartnerDetails',
type: "POST",
contentType: "application/json; charset=utf-8",
data: JSON.stringify(params),
dataType: "json", //not json . let me try to parse
success: function(msg, st) { . . . .
Run Code Online (Sandbox Code Playgroud)
这是webMethod:
<WebMethod()> _
Public Function GetPartnerDetails(ByVal ID As String) As String
'Dim objParam As IDictionary = CType(JsonConvert.DeserializeObject(ID), IDictionary)
'Dim rowID As String = objParam("ID")
Dim objController As New HealthComp.BLL.X12Partners.TradingPartnersController
Dim objInfo As TradingPartnersInfo = objController.FetchByPartnerID(Int32.Parse(ID))
Return JsonConvert.SerializeObject(objInfo)
End Function
Run Code Online (Sandbox Code Playgroud)
这是我从FireBug看到的:
响应标头
服务器:Microsoft-IIS/5.1 …
我遇到了一个我似乎无法弄清楚的问题,尽管它在Stackoverflow上有一个标准问题.
我正在尝试使用以下代码异步更新我的Bing地图(请注意,这是来自旧的Silverlight项目,似乎在WPF中不起作用)
_map.Dispatcher.BeginInvoke(() =>
{
_map.Children.Clear();
foreach (var projectedPin in pinsToAdd.Where(pin => PointIsVisibleInMap(pin.ScreenLocation, _map)))
{
_map.Children.Add(projectedPin.GetElement(ClusterTemplate));
}
});
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
我想从我的C#控制台应用程序中调用google url shortner API,我尝试实现的请求是:
POST https://www.googleapis.com/urlshortener/v1/url
Content-Type:application/json
{"longUrl":" http://www.google.com/ "}
当我尝试使用此代码时:
using System.Net;
using System.Net.Http;
using System.IO;
Run Code Online (Sandbox Code Playgroud)
主要方法是:
static void Main(string[] args)
{
string s = "http://www.google.com/";
var client = new HttpClient();
// Create the HttpContent for the form to be posted.
var requestContent = new FormUrlEncodedContent(new[] {new KeyValuePair<string, string>("longUrl", s),});
// Get the response.
HttpResponseMessage response = client.Post("https://www.googleapis.com/urlshortener/v1/url",requestContent);
// Get the response content.
HttpContent responseContent = response.Content;
// Get the stream of the content.
using (var reader …Run Code Online (Sandbox Code Playgroud) 我想使用bootstrap datepicker并将所选日期与knockoutjs绑定.
使用datepicker的函数:
$(function() {
// create the departure date
$('#depart-date').datepicker({
autoclose: true,
format: 'yyyy/mm/dd',
}).on('changeDate', function(ev) {
ConfigureReturnDate();
});
$('#return-date').datepicker({
autoclose: true,
format: 'yyyy/mm/dd',
startDate: $('#depart-date').val()
});
// Set the min date on page load
ConfigureReturnDate();
// Resets the min date of the return date
function ConfigureReturnDate() {
$('#return-date').datepicker('setStartDate', $('#depart-date').val());
}
});
Run Code Online (Sandbox Code Playgroud)
这是我想要使用的小提琴,但不知道如何去做. http://jsfiddle.net/zNbUT/276/
我想从VS2012转换到VS2015的项目.现在我得到以下错误,它第一次得到它所以我有点迷失在如何解决它或原因是什么.
严重级代码描述项目文件行抑制状态错误命令""C:\ Program Files(x86)\ Microsoft\ILMerge\ILMERGE.EXE"/ t:console /targetplatform:v4,%systemroot%\Microsoft.NET\Framework\v4 .0.30319 /out:BlobClient.exe StrikeMedia.BlobStorage.CmdLineTool.exe StrikeMedia.ServiceBus.dll StrikeMedia.BlobStorage.dll"退出,代码为3. StrikeMedia.BlobStorage.CmdLineTool
希望你能帮助我.
谢谢
我遇到了麻烦,制作了Ninject和WebAPI.All合作.我将更加具体:
首先,我玩了WebApi.All包,看起来它对我来说很好.
第二,我加入RegisterRoutes的Global.asax下一行:
routes.Add(new ServiceRoute("api/contacts", new HttpServiceHostFactory(), typeof(ContactsApi)));
Run Code Online (Sandbox Code Playgroud)
所以最终的结果是:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.Add(new ServiceRoute("api/contacts", new HttpServiceHostFactory(), typeof(ContactsApi)));
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
ControllerBuilder.Current.SetControllerFactory(new NinjectControllerFactory());
}
Run Code Online (Sandbox Code Playgroud)
一切似乎都很好,但是当我试图将用户重定向到特定的操作时,例如:
return RedirectToAction("Index", "Home");
Run Code Online (Sandbox Code Playgroud)
localhost:789/api/contacts?action=Index&controller=Home
是不好的.我划了一条线RegisterRoute,现在它看起来像:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new …Run Code Online (Sandbox Code Playgroud) 我在AdminUsers视图中有一个网格链接
grid.Column(header: "", format: (item) => (condition ? Html.ActionLink("Impersonate", "Impersonate", "Admin", new { id = item.username }, null) : Html.Label("Impersonate"), style: "webgrid-column-link"),
Run Code Online (Sandbox Code Playgroud)
在控制器中,我有
public ActionResult Impersonate(string id)
{
string result = ORCA.utilities.users.setImpersonation(id);
if(result == "nocommonfields")
return RedirectToAction("AdminUsers", "Admin");
else
return RedirectToAction("terms_of_use", "Forms");
}
Run Code Online (Sandbox Code Playgroud)
当我返回AdminUsers页面时,如何发送错误消息?
我正在使用一个对象但在对象内部我有一个属性是一个对象列表.我希望将该对象与其中的列表对象一起传递,但是当我提交表单时列表为空.我不知道如何处理这个问题.
类
public class VSTAttendance
{
public int MemberID { get; set; }
public string Name { get; set; }
public string Surname { get; set; }
public bool Attendant { get; set; }
}
public class ServiceAttendance
{
public int AttendanceID { get; set; }
public int AttendanceTypeID { get; set; }
public string AttendanceType { get; set; }
public DateTime Service { get; set; }
public int ServiceID { get; set; }
public string Speaker { get; set; …Run Code Online (Sandbox Code Playgroud) c# ×5
.net ×1
.net-4.0 ×1
asp.net ×1
asp.net-mvc ×1
azure ×1
delegates ×1
google-api ×1
jquery ×1
json ×1
knockout.js ×1
next.js ×1
ninject ×1
parameters ×1
web-services ×1
wpf ×1