Search Results

Search found 9325 results on 373 pages for 'mvc 2'.

Page 21/373 | < Previous Page | 17 18 19 20 21 22 23 24 25 26 27 28  | Next Page >

  • MVC app not working on server but is fine on development machine

    - by GB
    Hello, I am able to run my application just fine on my dev machine but as soon as I publish it to the web server some functionality is lost. Any type of .ajax POST does not work usually with a 401 unauthorized error. The server is Windows 2008 with IIS7. I also installed Visual Studio 2008 with MVC2 on the server and ran the application directly on the server and the same .ajax POST does not work but the error changed to 500 unknown. Thanks for the help.

    Read the article

  • ASP.NET MVC: Accessing ModelMetadata for items in a collection

    - by DanM
    I'm trying to write an auto-scaffolder for Index views. I'd like to be able to pass in a collection of models or view-models (e.g., IEnumerable<MyViewModel>) and get back an HTML table that uses the DisplayName attribute for the headings (th elements) and Html.Display(propertyName) for the cells (td elements). Each row should correspond to one item in the collection. When I'm only displaying a single record, as in a Details view, I use ViewData.ModelMetadata.Properties to obtain the list of properties for a given model. But what happens when the model I pass to the view is a collection of model or view-model objects and not a model or view-model itself? How do I obtain the ModelMetadata for a particular item in a collection?

    Read the article

  • CSS does not load when updated in an ASP.NET MVC 2 website

    - by dannie.f
    I have a weird problem. Whenever the website designer updates the css file for the website I am working on. I overwrite the old css file with the new version and copy any new images. The problem is that whenever I do this the images in the website header no longer loads along with some other styles that depend on css loading some images. I have tried everything, clearing the browser cache, deleting asp.net temporary files, restarting the browser, changing browsers and pressing Ctrl + F5. Still the images don't load. What usually happens also is that the problem would eventually correct itself and I wouldn't know why. This driving me crazy. Does anyone else have the problem and know how to fix it? If this helps, the header is located in a partial view and the master page loads the css file using Url.Content. The images are css sprites. This issue persists no matter which browser I try, Chrome, Firefox or IE. I am using Visual Studio 2008 SP1 on Windows 7 Ultimate. Other team members have experienced this issue.

    Read the article

  • asp.net mvc making delete usercontrol information passing on and off

    - by mazhar kaunain baig
    i am creating a generalize deleteusercontrol , my aim is that on the listing page where all the records are listed when the delete is pressed i want to display the acknowledgment on the same page up the list. I had little idea to do that q1) first of all where will i place my deleteusercontrol(in the shared folder?). q2) on and off the deleteusercontrol as the acknowledgment will not be there all the time how would i be doing that on delete press. i don't want to pass any data in the querystring. q3)how would i be passing the records list id and listname to the general deleteusercontrol as it would be same for all the listing

    Read the article

  • asp.net mvc outputting json with backslashes ( escape) despite many attemps to filter

    - by minus4
    i have an asp.net controller that output Json as the results a section of it is here returnString += string.Format(@"{{""filename"":""{0}"",""line"":[", file.Filename); what i get returned is this: "{\"DPI\":\"66.8213457076566\",\"width\":\"563.341067\",\"editable\":\"True\",\"pricecat\":\"6\",\"numpages\":\"2\",\"height\":\"400\",\"page\":[{\"filename\":\"999_9_1.jpg\",\"line\":[]},{\"filename\":\"999_9_2.jpg\",\"line\":[]}]]" i have tried to return with the following methods: return Json(returnString); return Json(returnString.Replace("\\",""); return Json will serialize my string to a jSon string, this i know but it likes to escape for some reason, how can i get rid of it ???? for info this is how i call it with jQuery: $.ajax({ url:"/Products/LoadArtworkToJSon", type:"POST", dataType: "json", async: false, data:{prodid: prodid }, success: function(data){ sessvars.myData = data; measurements = sessvars.myData; $("#loading").remove(); //empty the canvas and create a new one with correct data, always start on page 0; $("#movements").remove(); $("#canvas").append("<div id=\"movements\" style=\"width:" + measurements.width + "px; height:" + Math.round(measurements.height) + "px; display:block; border:1px solid black; background:url(/Content/products/" + measurements.page[0].filename + ") no-repeat;\"></div>"); your help is much appreciated thanks

    Read the article

  • How to force asp.net MVC 2 to redirect to default controller/action

    - by Chris
    In a brand new ASP.NET MVC2 project, I want the user to be redirected to http://<mysite>/home/index rather than http://<mysite>/ We do this with our other sites for tracking purposes, to avoid the scenario where hits to the same default page show up as http://<mysite>/ http://<mysite>/default.aspx How do I accomplish this so that http://<mysite>/ automatically redirects to whatever default controller/action I have set up in my routing? Please note that I am aware the two are functionally equivalent, as the default controller action will be executed either way. I'm just interested in forcing consistent URLs in the browser.

    Read the article

  • overriding Method asp.net mvc

    - by parminder
    Hi Experts, Can I override an ActionResult method. Say I have a method Index in AccountController like this public ActionResult Index() { return View(); } Can I have one more method with same name but with differnt parameters like public ActionResult Index(int userid) { return View(); } what will be the entries in the global.asax Regards Parminder

    Read the article

  • ASP.NET MVC Catch All

    - by rkrauter
    The ignore route is defined like this: routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); Why not routes.IgnoreRoute("{resource}.axd/{*}"); What is the significance of pathInfo? Thanks.

    Read the article

  • ASP.NET MVC Page - Dropdown control doesn't function with Keyboard Arrow Keys

    - by Rita
    Hi I have a page that has a Dropdown control (ddlDeliveryMethod). So that when the user selects particular option from the Dropdown(using MOUSE), the respective Div ID's are loaded. But instead of Mouse, if we simply use the arrow keys from Keyboard, the respective DIV ID's are not showing. Is there any workaround for this. Appreciate your responses. Here is my code: // based on Delivery method, display the respective fields $("#ddlDeliveryMethod").change(function() { $('#divRegisteredMail').hide(); $('#divRegisteredEmail').hide(); $('#divRegisteredFax').hide(); $('#divSaveForFuture').hide(); switch ($("#ddlDeliveryMethod ").val()) { case ' -- Select one -- ': break; case 'Email': $('#divRegisteredEmail').show(); break; case 'Mail': $('#divRegisteredMail').show(); break; case 'Fax': $('#divRegisteredFax').show(); break; default: caption = "default"; break; } });

    Read the article

  • Errors when creating a custom Querable object with MVC and Subsonic pagedlist

    - by minus4
    hiya, i have the following code but when i try and create a new IQuerable i get an error that the interface cannot be implemented, if i take away the new i get a not implemented exception, have had to jump back and work on some old ASP classic sites for past month and for the life of me i can not wake my brain up into C# mode. Could you please have a look at below and give me some clues on where i'm going wrong: The code is to create a list of priceItems, but instead of a categoryID (int) i am going to be showing the name as string. public ActionResult ViewPriceItems(int? page) { var crm = 0; page = GetPage(page); // try and create items2 IQueryable<ViewPriceItemsModel> items2 = new IQueryable<ViewPriceItemsModel>(); // the data to be paged,but unmodified var olditems = PriceItem.All().OrderBy(x => x.PriceItemID); foreach (var item in olditems) { // set category as the name not the ID for easier reading items2.Concat(new [] {new ViewPriceItemsModel {ID = item.PriceItemID, Name = item.PriceItem_Name, Category = PriceCategory.SingleOrDefault( x => x.PriceCategoryID == item.PriceItem_PriceCategory_ID).PriceCategory_Name, Display = item.PriceItems_DisplayMethod}}); } crm = olditems.Count() / MaxResultsPerPage; ViewData["numtpages"] = crm; ViewData["curtpage"] = page + 1; // return a paged result set return View(new PagedList<ViewPriceItemsModel>(items2, page ?? 0, MaxResultsPerPage)); } many thanks

    Read the article

  • Proper way to build a data Repository in ASP.NET MVC

    - by rockinthesixstring
    I'm working on using the Repository methodology in my App and I have a very fundamental question. When I build my Model, I have a Data.dbml file and then I'm putting my Repositories in the same folder with it.... IE: Data.dbml IUserRepository.cs UserRepository.cs My question is simple. Is it better to build the folder structure like that above, or is it ok to simply put my Interface in with the UserRepository.cs? Data.dbml UserRepository.cs              which contains both the interface and the class Just looking for "best practices" here. Thanks in advance.

    Read the article

  • Starting with asp.net MVC

    - by Josemalive
    Hello, Actually im doing a home page that only have an action called Index() that returns the view Index.ascx. This index page will be composed by lastest news and lastest registered users, i think that create two partial views is the best idea (this way i could use it in other views). for other hand i have a data access class that calls to database for get stuff (get last news, get last users, etc...) My question is simple, should i call to the this data access class in the Index() action of my HomeController, and add to the ViewData the data obtained? I think that this index() action shouldnt be the responsable of passing this data to the partial views, right? Could you give me a hand? im messing too much? ;-) Thanks in advance. Best Regards. Jose

    Read the article

  • where should I put the EF entity and data annotations in asp.net mvc + entity framework project

    - by giddy
    So I have a DataEntity class generated by EntityFramework4 for my sqlexpress08 database. This data context is exposed via a WCF Data Service/Odata to silverlight and win forms clients. Should the data entities + edmx file (generated by EF4) go in a separate class library? The problem here then is I would specify data annotations for a few entities and then some of them would require specific MVC attributes (like CompareAttribute) so the class library would also reference mvc dlls. There also happen to be entity users which will be encapsulated or wrapped into an IIdentity in the website. So its pretty tied to the mvc website. Or Should it maybe go in a Base folder in the mvc project itself? Mostly the website is data driven around the database, like approve users, change global settings etc. The real business happens in the silverlight and win forms apps. Im using mvc3 rc2 with Razor. Thanks

    Read the article

  • Prevent ASP.NET MVC Bundles Loading more than once

    - by Tim
    is there an inbuilt method of tracking if a bundle has already been loaded? I have several edit views which forexample require jquery and jquery.Validate etc libraries. Which i don't need to reference on the main layout page. Since a page could consist of several different conditional libraries ... ideally i would like @scripts.Render to know if i have already referenced a library and prevent its reloading. Cheers Tim

    Read the article

  • Set a dropdown option to selected based on get variable in url in Razor MVC

    - by Mason240
    I have a dropdown menu in a GET form. When the user hits submit, they are directed to the same page and shown the form again. I would like to have the dropdown option the user displayed in the last page already selected. So for example: @Html.DropDownList("Type", null, "Type", new { @class = "sbox-input" } ) website.com/Search?Type="Beef" <select name="Type"> <option value="Fish" >Fish</option> <option value="Chicken" >Chicken</option> <option value="Beef" selected="selected">Beef</option> </select> A jQuery solution would work just as well.

    Read the article

  • Get selected value of dropdownlist in asp.net MVC

    - by Xulfee
    how can i get select value of dropdownlist and here is my code which is working fine. var list = new[] { new Person { Id = 1, Name = "Name1" }, new Person { Id = 2, Name = "Name2" }, new Person { Id = 3, Name = "Name3" } }; var selectList = new SelectList(list, "Id", "Name", 2); ViewData["People"] = selectList; <%= Html.DropDownListFor(model => model.Peoples, ViewData["People"] as IEnumerable<SelectListItem>)%>

    Read the article

  • C# mvc 3 using selectlist with selected value in view

    - by Rob
    I'm working on a MVC3 web application. I want a list of categories shown when editing a blo from whe applications managements system. In my viewmodel i've got the following property defined for a list of selectlistitems for categories. /// <summary> /// The List of categories /// </summary> [Display(Name = "Categorie")] public IEnumerable<SelectListItem> Categories { get; set; } The next step, my controller contains the following edit action where the list of selectlistitems is filled from the database. public ActionResult Edit(Guid id) { var blogToEdit = _blogService.First(x => x.Id.Equals(id)); var listOfCategories = _categorieService.GetAll(); var selectList = listOfCategories.Select(x =>new SelectListItem{Text = x.Name, Value = x.Id.ToString(), Selected = x.Id.Equals(blogToEdit.Category.Id)}).ToList(); selectList.Insert(0, new SelectListItem{Text = Messages.SelectAnItem, Value = Messages.SelectAnItem}); var viewModel = new BlogModel { BlogId = blogToEdit.Id, Active = blogToEdit.Actief, Content = blogToEdit.Text, Title = blogToEdit.Titel, Categories = selectList //at this point i see the expected item being selected //Categories = new IEnumerable<SelectListItem>(listOfCategories, "Id", "Naam", blogToEdit.CategorieId) }; return View(viewModel); } When i set a breakpoint just before the view is being returned, i see that the selectlist is filled as i expected. So at this point everything seems to be okay. The viewmodel is filled entirely correct. Then in my view (i'm using Razor) i've got the following two rules which are supposed to render the selectlist for me. @Html.LabelFor(m => m.Categories) @Html.DropDownListFor(model=>model.Categories, Model.Categories, Model.CategoryId) @Html.ValidationMessageFor(m => m.Categories) When I run the code and open the view to edit my blog, I can see all the correct data. Also the selectlist is rendered correctly, but the item i want to be selected lost it's selection. How can this be? Until the point the viewmodel is being returned with the view everything is okay. But when i view the webpage in the browser, the selectlist is there only with out the correct selection. What am I missing here? Or doing wrong?

    Read the article

  • How do I do multipled level routes best in MVC

    - by Lilja
    I have a site where I would like an URL like: /Some maincategory name/{id}/Some subcategory name/{id}/Some item name/{id} I include the IDs of each level since the name is not unique. This is doable but I have to create a new routing for each level. My Html.ActionLink also looks nasty. Each level has it's own controller since the levels are completely different. The URLs could be something like this: _/Birds/2/Waders/4/Flamingos/23_ _/Mammals/5/Dogs/23/Longeared/25/Somedog/76_ _/Insects/7/Spiders_ This is just an example and not what I'm going to use. My applications has nothing to do with animals. Is there a good way of doing this or should I use the standard routing instead?

    Read the article

  • asp.net mvc validation must be a number custom error

    - by Para
    Hi, I am new to asp.net and I have a problem. When the users insert in a editor for a decimal field something other than numbers, they get an error "Field name" is not a number. But I don't want them to receive this message I want them to receive another message. I have no problem with this with required and range validators. Is there any way for me to do this? I am not refering necessarily to changing the culture just displaying another message. Thanks.

    Read the article

  • Generic ASP.NET MVC Route Conflict

    - by Donn Felker
    I'm working on a Legacy ASP.NET system. I say legacy because there are NO tests around 90% of the system. I'm trying to fix the routes in this project and I'm running into a issue I wish to solve with generic routes. I have the following routes: routes.MapRoute( "DefaultWithPdn", "{controller}/{action}/{pdn}", new { controller = "", action = "Index", pdn = "" }, null ); routes.MapRoute( "DefaultWithClientId", "{controller}/{action}/{clientId}", new { controller = "", action = "index", clientid = "" }, null ); The problem is that the first route is catching all of the traffic for what I need to be routed to the second route. The route is generic (no controller is defined in the constraint in either route definition) because multiple controllers throughout the entire app share this same premise (sometimes we need a "pdn" sometimes we need a "clientId"). How can I map these generic routes so that they go to the proper controller and action, yet not have one be too greedy? Or can I at all? Are these routes too generic (which is what I'm starting to believe is the case). My only option at this point (AFAIK) is one of the following: In the contraints, apply a regex to match the action values like: (foo|bar|biz|bang) and the same for the controller: (home|customer|products) for each controller. However, this has a problem in the fact that I may need to do this: ~/Foo/Home/123 // Should map to "DefaultwithPdn" ~/Foo/Home/abc // Should map to "DefaultWithClientId" Which means that if the Foo Controller has an action that takes a pdn and another action that takes a clientId (which happens all the time in this app), the wrong route is chosen. To hardcode these contstraints into each possible controller/action combo seems like a lot of duplication to me and I have the feeling I've been looking at the problem for too long so I need another pair of eyes to help out. Can I have generic routes to handle this scenario? Or do I need to have custom routes for each controller with constraints applied to the actions on those routes? Thanks

    Read the article

  • What does the "=>" mean in asp.net mvc?

    - by quakkels
    Hey SO, I've got a pretty noob question for ya. I keep seeing this syntax: <%= Html.LabelFor(model => model.Email) %> ...and I have no idea what the = means. I thought it was syntax for linq2sql or ado.net entity framework but I'm just using straight ado.net. I don't understand why the VWD used that syntax when generating the Create form. What does = mean?

    Read the article

< Previous Page | 17 18 19 20 21 22 23 24 25 26 27 28  | Next Page >