asp.net-mvc-3

MVC 3 Razor- how to bind new model to webgrid using jQuery ajax

假装没事ソ 提交于 2020-01-16 00:24:44
问题 I have an issue with updating my webgrid with a new model which is returned from my DAL. On my view I have checkboxes used to filter data displayed on the grid. Once a checkbox is ticked this calls some jQuery ajax function which passes the checkbox values to my method in my controller. This then calls my DAL and it returns a new list of my model with the correct values. I return this list to my view but when the page loads nothing is different. The grid looks the same which isn't what I

Multiple selection of ListBox is not working in asp.net mvc4

独自空忆成欢 提交于 2020-01-15 19:11:14
问题 I have bound listbox data from entity framework. I have selected multiple values in that listbox. But, the values are not fired. The count of the property is 0 only. I am using the code below: public class Sample1 { [Key] public int SampleId{ get; set; } public string SampleDesc{ get; set; } } public class ExpModel { public List<Sample1> Sample{ get; set; } } public ActionResult Index() { ViewData["SampleList"] = new List<Sample1>(entity.samp); return View(); } @Html.ListBoxFor(model => model

MVC3 partial view postback not work?

穿精又带淫゛_ 提交于 2020-01-15 18:52:23
问题 I have LogOn partial view in the AccountController : public ActionResult LogOn() { return PartialView(); } // // POST: /Account/LogOn [HttpPost] public ActionResult LogOn(LogOnModel model, string returnUrl) { if (ModelState.IsValid) { if (ModelState.IsValid) { if (MembershipService.ValidateUser(model.UserName, model.Password)) { FormsService.SignIn(model.UserName, model.RememberMe); } else { ModelState.AddModelError("", Resources.Account.Account.LoginFailureText); } } } return PartialView

MVC3 partial view postback not work?

99封情书 提交于 2020-01-15 18:51:51
问题 I have LogOn partial view in the AccountController : public ActionResult LogOn() { return PartialView(); } // // POST: /Account/LogOn [HttpPost] public ActionResult LogOn(LogOnModel model, string returnUrl) { if (ModelState.IsValid) { if (ModelState.IsValid) { if (MembershipService.ValidateUser(model.UserName, model.Password)) { FormsService.SignIn(model.UserName, model.RememberMe); } else { ModelState.AddModelError("", Resources.Account.Account.LoginFailureText); } } } return PartialView

Could not load type 'Google.Apis.Requests.IErrorResponseHandler' from assembly 'Google.Apis'

白昼怎懂夜的黑 提交于 2020-01-15 15:30:37
问题 I am Google Auth api Calendar in .net. I have copied the code from this link:Refresh Token Expiration time Google calendar Could not load type 'Google.Apis.Requests.IErrorResponseHandler' from assembly 'Google.Apis, Version=1.6.0.16897, Culture=neutral, PublicKeyToken=null' Here is my code: private CalendarService CreateService(string token) { //KeyValuePair<string, string> credentials = Ninject.Web.Common.Get3LOCredentials(); var provider = new NativeApplicationClient

asp.net mvc 3 - remove time from date

﹥>﹥吖頭↗ 提交于 2020-01-15 15:28:40
问题 I am having a model in with a DateTime property: public DateTime? DateNaissance { get; set; } and a View with a @Html.TextBoxFor for the property @Html.TextBoxFor(model => model.DateNaissance) All I want is to get the date typed, however, when I type in 01/06/2012 as date I am having the "01/06/2012 00:00:00" in the controller All I want is to get the date, why the time is added ?, how to automatically remove it ? I tried out without success: [DisplayFormat(DataFormatString = "{0:dd/MM/yyyy}"

How to Elevate Role in ASP.net From anonymous to windows auth?

会有一股神秘感。 提交于 2020-01-15 14:23:30
问题 I have a few websites which allow both anonymous and window auth users at the same time. Basically if you hit the site with IE or Webkit based browsers on a windows system, the server instantly recognizes your active directory user and group. In the past I've provided a link to a windows auth only page which allows the current user to login, or bounce back to where they started. I find the management of this kind of frustrating as I need to make certain that IIS has the correct security

Async with MVC3 and ASP.NET4.5

。_饼干妹妹 提交于 2020-01-15 12:25:10
问题 I am using MVC3 and ASP.NET 4.5 As I understand it, even though I am using ASP.NET 4.5, I cannot use the new MS "Await", "Task" Async features. Am I correct? Do I have to still use the old "AsyncController" approach. Finally, all I am trying to do is "Async" a private method, not the full Action, like what would happen with a "SendMail" method call. ie. public ActionResult Index() { SendMail(); // Inbuilt Async //Copy Document in DB. This is coded by private method in class, but needs to be

dynamic Url.Content

空扰寡人 提交于 2020-01-15 12:19:10
问题 I am trying to build a website in C# using MVC3 with Razor. I have to build it with themes, but I have problems setting a dynamic content to Url.Content, like it follows: <img src="@Url.Content("~/Content/themes/THEME-NAME/images/logo.png")" alt="logo" /> and I would like to set the value of THEME-NAME from my code. Let's say from an Application object. Is it possible? Thanks. 回答1: Give the ViewBag a shot. in your controller action I would put : ViewBag.ThemeName = "SomeName"; in your view :

ASP.NET MVC3 , Why we need strongly-typed View?

≯℡__Kan透↙ 提交于 2020-01-15 11:38:06
问题 I have read Scott Guthrie's Blog - ASP.NET MVC 3: New @model keyword in Razor One things i don't realizes is a page will binding value in different ways,but why we have to enforce the view binding from Model? For example, a user control panel of forum website, it may have the user information, the post history, the user setting etc. From the view of data model, the binding source can be come from different table : users, posts, user_settings etc. However, one view only can reference one