Search Results

Search found 9749 results on 390 pages for 'mvc helpers'.

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

  • 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

  • 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

  • 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

  • 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

  • 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

  • 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

  • Making id'less url in asp.net mvc razor

    - by Sushant
    I am working with URL routing , and have some issues. I want my url to be like this: www.domain.com/p/myproduct But I also want to be able to retrieve the ID of the product, without accessing the database. I thought about having a URL like: www.domain.com/p/myproduct/1 But if I could hide the ID it would be better. So, how do I do it the simplest way? Currently my Global.asax has the following route: routes.MapLocalizedRoute("Product", "p/{productId}/{SeName}", new { controller = "Catalog", action = "Product", SeName = UrlParameter.Optional }, new { productId = @"\d+" }, new[] { "Nop.Web.Controllers" });

    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

  • ASP.NET MVC Routing

    - by creativeincode
    My website uses categories and sub-categories. I'd like the follow mapping: /Category/Fruit /Category/Fruit/Apples But if I use the below: routes.MapRoute( "Category", // Route name "Category/{category}/{subcategory}", // URL with parameters new { controller = "Entity", action = "Category" } // Parameter defaults ); I get a 404 for /Category/Fruit however /Category/Fruit/Apples works ok. I'd like /Category/Fruit to work as well but I can't add another route with the same name. How do I get around this? Thanks in advance.

    Read the article

  • .net MVC 3 multiple columns

    - by Teodor
    i want to display a list in more columns with 5 items/column my code now doesn't work as expected: @{ var c=0; } <div > @foreach (var item in Model) { c += 1; @Html.ActionLink(item.Judet , "Browse", new { judet = item.Judet }) <br /> if (c == 5){ Response.Write("</div><div style='border: 1px solid red;'>"); c = 0; } } </div>

    Read the article

  • Saving contents of ApplicationState in ASP.Net (MVC)

    - by Saqib
    I have an internal app used to edit XML files on disk. The XML files are loaded into an object model which is stored in ApplicationState. I need to save this data. The one option is to do this every time the user changes some data. However, this seems a bit inefficient - writing the data out to disk each time a change is made. Instead, is it possible to be notified whenever the user closes their browser, plus just before the web server exits? Thus, the data would be saved each time a session ends, plus when the computer shuts down, etc. I thought that Application_End(), Application_Error() and Session_End() in Global.asax would provide this, but these methods don't seem to be called.

    Read the article

  • How can you block access form internet explorer in asp mvc

    - by Chase Aucoin
    I love microsoft development products! I hate microsoft browsers... I have made the decision to cut ties with internet explorer until they add support for some common W3 approved items. Namely 'multiple' in forms as well as about 5 other things... and as such I would like to urge my visitors to use a better browser. is there a way to setup an http handler or perhaps something in the asax file to route all ie users to a custom page? Thanks for the help! p.s. microsoft why must you make me love you and hate you.

    Read the article

  • Dynamically compose ASP MVC view based on context

    - by robertFall
    I have several views that are composed of several partial views based on context. For example, we have a Project view that shows all the details of a project, which includes the scalar values, name etc, and also all the assigned employees, tasks and/or clients. The problem I have is that certain types of project have all of the above sections while others have only two or even on section, ie. details only. What is the best way to compose the Projects master view? I don't want to have logic to check the project in the view. Is there a way to compose a view in code by programatically rendering the relevant partials and ignoring the rest? Otherwise are there any other ideas how to do this in a maintainable way? I could of course just render the partials using if statements to check if they apply, but that way the view contains VERY important logic. In another situation we want to use this method to display content based on the type of subscription a user has. Thanks!

    Read the article

  • Ideas in implenting the following entry form in ASP.NET MVC 2

    - by KiD0M4N
    Hi guys, I have a very simple data entry form to implement. It looks like this: Obviously I have mocked out the actual requirements but the essence is similar. Entering a name and clicking history should bring up a pop up pointing to the url '/student/viewhistory/{name}' Name and age are required fields The sub form (in the mockup) with Class (a drop down, containing the numbers 1 - 10) and Subject (containing A - D, say) form a unique pair of values for which a score is required. So, selecting the Class and Subject, entering a score and clicking on Add should 'add' this record for the student. Then the user should be able to click Save (to persist the entry to the database) or be able to add further (class, subject, score) pairs to the entry. Any ideas how to smartly implement this? (I am coming from a DWH field... so thinking in a stateless manner is slightly foreign to me.) Any help is appreciated. I would imagine a smart use of jQuery would give a easy solution. Regards, Karan

    Read the article

  • cannot select items list from telerik mvc combox box

    - by user384080
    I'm trying to implement the comboboxfor as follow: @(Html.Telerik().ComboBoxFor(model => model.ProductId) .AutoFill(true) .HighlightFirstMatch(true) .DataBinding(binding => binding.Ajax().Select("GetProductByKeyword", "Product")) I managed to populate the list but does not allow me to select from the list. Also, I need to show the product name but at the same time I need to bind the productId as this is Id will stored in the database. any ideas?

    Read the article

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