razor

Json does not contain a definiton for 'stringify'?

感情迁移 提交于 2019-12-25 19:13:11
问题 I am trying to update a JIRA issue using Visual Studio 2015, Microsoft Razor, and C# with Json.Net 10.0.2. The code is: public String updateJiraIssue(object objJira2) { JiraService.open("PUT", JiraUrl + "/rest/api/2/issue/NPI-24"); JiraService.setRequestHeader("Content-Type", "application/json"); JiraService.setRequestHeader("Accept", "application/json"); JiraService.setRequestHeader("X-Atlassian-Token", "nocheck"); JiraService.setRequestHeader("Authorization", "Basic " +

How could i change layout page from viewpage in mvc

主宰稳场 提交于 2019-12-25 18:32:04
问题 I am working on asp.net mvc 3 with razor. I have a layout(master) page in my project. It contains a side panel with 4 links and place for viewpage(@RenderBody). when user clicks on link1 it redirects to viewpage1 and link1 should be selected, and when he clicks link2 it redirects to viewpage2 and link2 should be selected so on. It redirecting very well to required pages but it always selects the link1 only though i clicked link2,link3,link4. How could i select the appropriate link in layout

Razor CheckBoxFor on List<string>

烂漫一生 提交于 2019-12-25 18:30:05
问题 I can't seem to figure out how to get a list of strings to render in my form as checkboxes. Tried a few things from various sites and questions/answers on here with no luck. MODEL var model = new ProjectModel() { ProjectType = new List<string>() { "Brand Creation", "Web Design", "Graphic Design", "Custom Programming", "E-Commerce", "Other" }, }; VIEW - I've tried the following ways. @foreach (var item in Model.ProjectType) { @Html.CheckBoxFor(model => true, item) <br /> } @foreach (var item

this.submit is not triggering GET call

限于喜欢 提交于 2019-12-25 18:17:28
问题 Why isn't the call this.submit() not triggering a submit and calling my controller? The dev tools in Chrome says there is an error and that the function doesn't exist! $('form').submit(function(e) { e.preventDefault(); var geocoder = new google.maps.Geocoder(); var address = document.getElementById('SearchQuery').value; geocoder.geocode({ 'address': address }, function (results, status) { if (status == google.maps.GeocoderStatus.OK) { alert("Location found: " + results[0].geometry.location);

Asp.Net MVC 3 not binding collections to models on posting

佐手、 提交于 2019-12-25 17:18:28
问题 i have a object with many properties of which one is an array of some other complex object something like this class obj1 { public string prop1 {get; set;} public string prop2 {get; set;} public obj2[] array {get; set;} } class obj2 { SomeEnum Type{get; set;} string Content{get; set;} } I have created an editor template for the array of obj2 lets name it obj2ArrayTemplate which is like this @for (int i = 0; i < Model.Length; i++) { @Html.EditorFor(model=>model[i],"obj2Template") } and an

Error with DropDownList when CKEditor is also in use on page [duplicate]

怎甘沉沦 提交于 2019-12-25 17:06:35
问题 This question already has answers here : The ViewData item that has the key 'XXX' is of type 'System.Int32' but must be of type 'IEnumerable<SelectListItem>' (6 answers) Closed 3 years ago . I have a dropdownlist that is working just fine, but when I have add a CKEditor (ckeditor-standard 4.5.7) to handel EditorFor helper I'm getting this error: The ViewData item that has the key 'OccupationId' is of type 'System.Int32' but must be of type 'IEnumerable'. Removing the CkEditor solve this error

The name does not exist in the current context (razor)

丶灬走出姿态 提交于 2019-12-25 16:55:29
问题 I'm having a few issues with razor and yet again it's stressing me out. I opened a project which is littered with Red Squiggles within the razor. This is very much a challenge as I'm a Webforms developer moving over to MVC. I'm running visual studio 2015 enterprise. At first I thought it might be a version issue but all seems good. WebConfig seems up to date. I'm at a loss, and in need of guidance. Any help greatly appreciated! ///EDITS Views web.config. <add namespace="System.Web.Mvc" />

The name does not exist in the current context (razor)

守給你的承諾、 提交于 2019-12-25 16:55:28
问题 I'm having a few issues with razor and yet again it's stressing me out. I opened a project which is littered with Red Squiggles within the razor. This is very much a challenge as I'm a Webforms developer moving over to MVC. I'm running visual studio 2015 enterprise. At first I thought it might be a version issue but all seems good. WebConfig seems up to date. I'm at a loss, and in need of guidance. Any help greatly appreciated! ///EDITS Views web.config. <add namespace="System.Web.Mvc" />

How to Bind data from Razor to Knockout?

风格不统一 提交于 2019-12-25 16:54:15
问题 I am using KnockOut JS and MVC. How do I bind the data from @ RAZOR view to my databind in KO. I tried doing this but did not return anything at the CONTROLLER. What I am trying to achieve here is that the Razorview renders the rows in Step3(View).I want to bind these rows to the KNOCKOUT so that I can pass this data to the Step4(View). Is there a better way?? VIEW: <tbody data-bind="foreach:ApprTable"> @for (int i = 0; i < UserWRInfo.Count; i++) { <tr> <td style="text-align: center"> <button

MVC - Require text box filled in when radio button selected

霸气de小男生 提交于 2019-12-25 16:47:44
问题 Trying to figure out the best way to handle this. I need to have logic in where it requires: 1) the Amount if a the color type allows an amount. 2) Credit cards if applicable (only allowed on 1 color at this time). In the View, I had the required validator however since it applies to the Amount, it shows on ALL amounts, not just the textbox for the radio button selected. I've tried jQuery to put Required attributes on the fields when clicked but seems like when I set it it applies to every