asp.net-mvc

ASP.NET MVC Cookie loses value when page is changed

When a user logs in to my site, I create a cookie with some info in it. However, whenever they change page from logging in, the cookie loses it's value. Cookie is still there but it's empty. I've checked my code and the cookie doesn't get rewritten by anything I've done. Does anyone have any idea to why the cookie becomes empty when the...

How do I display the duration it took to generate a page in a pages footer?

During debug builds I would like to show the duration it took, server side, to generate a page in the pages footer. So for example if a page takes 250ms server side I would like that displayed in the footer, in debug builds. How can I achieve this in an ASP.NET MVC project? ...

Should I make a ImageHelper in this situation?

Hi I'm working with a project (asp.net mvc) where I need to show pictures on one site. They gone have jquery and be surrounded by a div like <div><img/></div> I'm relatively new on MVC so I'm not sure what ways are the best to work in it yet. Should I do a ImageHelper so i can access it like <% Html.ImageJquery() %> or should i just do...

Starting with asp.net MVC

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 c...

Help with concept - filters and number of items

Please check http://www.alibaba.com/catalogs/cid/702/Laptops.html they have nice filter here with number of items for each. Note one detail - they have locations here. Same thing on olx.com - location and number of items for each category. Now imagine I have tables: [products] (Id, Name, CategoryId, LocationId) [Categories] (Id,Name) [...

ASP.NET MVC Map String Url To A Route Value Object

I am creating a modular ASP.NET MVC application using areas. In short, I have created a greedy route that captures all routes beginning with {application}/{*catchAll}. Here is the action: // get /application/index public ActionResult Index(string application, object catchAll) { // forward to partial request to return partial vi...

test is null in the controller upon post

I have the following codes and the test value is always null in the controller after the post. What is wrong with the following code: Model: public class Suitcase { public string Color { get; set; } public string[] Size { get; set; } public List<string> Clothes { get; set; } public List<Test> test { get; set; } } publi...

Paging in ASP.NET MVC

Can someone direct me to the links or anything where i can find the most efficient paging? ...

ASP.NET MVC - how to get the value from a textbox in my View?

If I have a textbox in my view: <div><%= Html.TextBox("Comments", Model.Comments)%></div> I want to post the contents of this textbox to the controller with an Ajax call. I only need this one value though, so I don't want to post the whole form back. <%= Ajax.ActionLink("update", "UpdateComments", new { comments = /* ...

Show PDF in HTML in web

Hi, I'm using the object tag to render PDF in HTML, but I'm doing it in MVC like this: <object data="/JDLCustomer/GetPDFData?projID=<%=ViewData["ProjectID"]%>&folder=<%=ViewData["Folder"] %>" type="application/pdf" width="960" height="900"> </object> and Controller/Action is public void GetPDFData(string projID, Project_Thin...

Responsibilities of Service and Repository layers

Just trying to get my head round the responsibilities of the service layer and repository layer when saving an object to my persistence store. My current under standing is this: In my controller I have created a "Note" object from the data submitted by the user (from the form). The user then calls "Save" on the "NoteService" (which is ...

Bast Practise: ASP.NET MVC Controller/Action with multiple object types

Hi, I'm looking for the best method for the following issue I have. I current have a large number of objects that all inherit for a single base object and are all very similar. Is there a solution available the will allow one create action and one edit action without needing to replicate a lot of the same code. So for example I might ...

Is there a preferred approach for Roles aware links in MVC 2

If an action has been decorated with [Authorize(Roles="Administrators")] is there a way to not display the link for the currently logged in user who is not in the declared role? It seems to me that baking a lot of if statements into the view to give this kind of "selective disclosure" is contrary to the MVC way, but I'm not sure what th...

adding a css class with Html.TextBox

Trying to add a 'class' html attribute, but I think the keyword 'class' is causing issues. <%: Html.TextBox("name", "value", new {class: " required "})%> Is there a workaround? ...

Asp.Net MVC - Binding of parameter to model value!

This seems like the model binding is causing me issues. Essentially I have a model called ProductOption and for the purpose of this question it has 2 fields ID (Int) PK ProductID (Int) FK I have a standard route set-up context.MapRoute( "Product_default", "Product/{controller}/{action}/{id}", new { c...

Changing URL with Routing, ASP.NET MVC

I am still very new to routing with asp.net mvc, so perhaps this is obvious and I am just missing the answer... I have a controller named 'pages', and it has several action results, 'Information', 'History' etc. Each action result takes a string, and from that, it returns a View based on the name of the string. So... Pages/Informatio...

Passing additional data value to strongly typed partial views in ASP.NET MVC

I have an OrderForm domain class, which has property subclasses, something like: interface IOrderForm { int OrderId { get; } ICustomerDetails CustomerDetails { get; set; } IDeliveryDetails DeliveryDetails{ get; set; } IPaymentsDetails PaymentsDetails { get; set; } IOrderDetails OrderDetails { get; set; } } My "De...

Windows authentication - MVC 2 ASP.Net

Hi there Having real problems moving my app over to windows authentication. the sql error messages are to do with problems creating in the aspnetdb.mdf file. I'm wondering whether the connection string is at fault or other elements of the web.config I have windows authentication set in IIS. web.config: <?xml version="1.0"?> <!-- ...

Windows Authentication results in 404 live

I have an asp.net mcv site I'm trying to build, and integrate windows authentication for domain user groups. I have Authentication mode = windows on, and have messed with several other settings and switches both in the website and the iis manager, but all result in the same thing. Everything works in testing on the localhost, pages dis...

SiteMap RootNode, get all child nodes where rootnode = "Home"

I wanted to write if/for each statement that will get me all the child node where the rootNode = "home" this is what i have so far if (topLevelNode.Title == "Home") { var topLevelNodes = SiteMap...... } foreach (SiteMapNode node in topLevelNodes) { ........................... } ...