asp.net-mvc-2

I need to add custom css to jquery tabs when it is selected, how?

你。 提交于 2019-12-02 09:40:17
I need to modify the css of .ui-state-active , .ui-widget-content .ui-state-active to the following: .ui-state-active , .ui-widget-content .ui-state-active { background-image: url('images/tab-over.png') !important; } However, when I do that I get the desired effect but other elements on the website get affected when clicked. I want this function only when I click a tab. Is there a safer way to do this ? Here is my html code: <div id="tabs"> <div id="left-side"> </div> <ul class="tab-menu"> <li id="home"> <a href="<%= Url.Action("GetCoreTab", "Tab") %>" class="a"> <b> <div id="home" class="menu

ASP.NET MVC2 Linq Where Clause using StartsWith

寵の児 提交于 2019-12-02 09:27:45
I have a few filters on my view, the first one is list by first name, last name and company name when one of these options are selected the user can then select a, b, c ... x, y, z to show only people starting with the selected letter. if (collection["Filter"] == "2") { presentations = presentations.Where(x => x.Person.FirstName.StartsWith("A")); presentations = presentations.OrderBy(x => x.Person.FirstName); } Results returned are similar to John Squirel Basil Boywiz David Smith This doesn't seem to work, what am I missing? I dug a little further, this is the query causing the problem. SELECT

What exactly is improved in MVC3 pertaining to validation?

心不动则不痛 提交于 2019-12-02 09:10:39
In asp.net-mvc-3 - Improved model validation with unobtrusive JavaScript and jQuery support. I think, unobtrusive-validation is already present in asp.net-mvc-2 Question : What exactly is improved in MVC3 pertaining to client validation? I think, unobtrusive-validation is already present in asp.net-mvc-2 Ah no, it wasn't. Question : What exactly is improved in MVC3 pertaining to client validation? The Ajax.* helpers are now using HTML5 data-* attributes which are interpreted by the jquery unobtrusive validation scripts. In ASP.NET MVC 2 the Ajax.* helpers were polluting the HTML with

DisplayName metadata does not show up on view

大兔子大兔子 提交于 2019-12-02 07:41:32
How will I show the correct DsiplayName on my view considering the following model. <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Project.Models.RegisterViewModel>" %> <asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server"> <% using (Html.BeginForm()) {%> <table> <tr> <td class="label"> <%: Html.LabelFor(model => model.User.UserPrimaryEmail)%> </td> <td class="field"> <%: Html.TextBoxFor(model => model.User.UserPrimaryEmail)%> </td> <td class="field-error"> <div class="field-error-msg"> <%: Html

Removing master layout from view (MVC2)

戏子无情 提交于 2019-12-02 07:28:20
if i need remove master layout from my view, how can i do it in MVC2? i tried put code in my view that was shown in documentation http://sparkviewengine.com/documentation/master-layouts : , but it still bring my Application.spark layout :-/ any ideas why? Not tested, but what if you create and empty master layout, and say <use master="EmptyMaster" /> in the top of your view? Or you could call on the empty master from the controller; return View("View", "EmptyMaster"); Don't know if it'll work, but it's worth a shot. I know this answer is a litle (maybe a lot) late but you can also use the

Html.Editor not rendering the value

跟風遠走 提交于 2019-12-02 07:22:45
I'm having problems making the Html.Editor rendering the desire HTML. Here is the scenario: // assign the value ViewBag.BeginDate = seaBeginEnd.beginDate; //View @Html.Editor("Begin", ViewBag.BeginDate as DateTime?) //HTML Source <div class="editor-field"> <input class="text-box single-line" id="Begin" name="Begin" type="text" value="" /> </div> I was specking to see a value of 1/19/2011 12:00:00 AM which is the value of ViewBag.BeginDate, any insights. Thanks for your help! I was specking to see a value of 1/19/2011 12:00:00 AM which is the value of ViewBag.BeginDate You cannot expect such

ASP.NET MVC2: “System.MissingMethodException: No parameterless constructor defined for this object.”

﹥>﹥吖頭↗ 提交于 2019-12-02 07:19:02
I am currently trying to modify the registration component of the default MVC project to accommodate a bit more to my project. I have modified the RegisterModel, Register.aspx and AccountController to do so. I can view the register view just fine, but when I submit, i get the error in the title, and it gives me little to nothing in the way of where the problem stems from. Can someone please steer me in the correct direction for me to fix this? UPDATE: I have added the inner exception as well UPDATE 2: I have modified the code to better form to Mystere Man's suggestions. I have created a

.NET MVC 4 JSON Post/Put char limit in Web.config

馋奶兔 提交于 2019-12-02 06:54:57
I am using the PUT verb to send JSON to a MVC controller. When I reach a certain limit I get a 500 error. If I scale back the JSON I send, then it sends just fine... Does anyone know of a configuration in the web.config that will allow a larger amount of JSON to be passed to my application? Here is the answer... My JSON object was quite large so .NET wouldn't allow it to pass due to a "security feature" The default is 2000, so I bumped it and it worked perfectly. <add key="aspnet:MaxJsonDeserializerMembers" value="5000"/> Approach - 1 <configuration> <system.web.extensions> <scripting>

Capturing HTML to String in MVC2.0

跟風遠走 提交于 2019-12-02 06:48:46
问题 I am new to MVC2.0. I use the below code to capture HTML and return it as a string. But this works fine in MVC1.0 and .NET 3.5 framework. Recently I upgraded the code to .NET 4.0 and MVC 2.0. Now this is no longer working and the context returns null. when I explore I saw two errors 1."This operation requires IIS integrated pipeline mode." 2.OutputStream = 'response.OutputStream' threw an exception of type system.Web.HttpException' Here is the calling function var htmlstring = this

store and display html tags in MVC

China☆狼群 提交于 2019-12-02 06:39:57
问题 How can I store post.content as html in database and how can I display with rendered html without tags. I am trying with following way, but it's not working. It can stored encode html in database but its not displayed rendered html. Any best practice would be appreciated. 1) //Saving post content in database as html public ActionResult Edit(Post post, FormCollection obj) { post.Content = Server.HtmlEncode(post.Content); } 2) //Displaying post content to view <%: System.Web.HttpUtility