I've got a problem with ASP.NET mvc stongly typed helpers.Here is example of wrong behavior:
[Code]....
will generate following inputs:
[Code]....
As you see generated name is wrong, because of wrong algorithm of extracting property name from lambda.The only way to avoid this bug is to create PartialView and pass item as its context.May be somebody knows other solutions? Do you consider it a bug or right behavior?
<p>Hi</p> <p>I'm a newbie in MVC but a veteran web forms developer. I really like the idea of strongly typed views but what if I have multiple objects to pass to my razor view. Would I then NOT use strongly typed views and just use the ViewBag?</p>
I personally dont like doing this as i find it makes it harder for me to know if someone changed the field name, or mis typed it during development - the other way you won't know until the page loads.
With the strongly typed version if something changes in your DAL etc the build will break - letting me know I've messed up.
Why do so many people appear to use weakly typed code in ASP.Net (in examples, MVC, etc)? Am i missing something?
Given the benefits of using strongly typed views to eliminate typed errors and the use of lambda expressions why would one use a dynamically typed view? When I use them I don't feel as safe as with strongly typed views. Am I missing something? Is there a special use for them?
Been using MvcContrib for strongly typed redirects since MVC1. Aren't we there yet with MVC3 or did I miss something (just been scratching the surface)
I have an application that is going to allow a user to create records of type Customer and Seller that have one section in common, but other fields that are unique to their types.
Both of these types will have an address block for their create view.
If I have a strongly typed Customer or Seller view, how can I use the view partial (containing the address block) that I've created? I've tried creating a view model, but I don't know how to have the create page inherit the Customer model and the addressBlock partial inherit the addressBlockForm partial model...
Long story short, I'm trying to add a few extra items to ViewData to make my life easier, and its an edge case that doesn't really justify its own model just for this one case. Keep reading for more specific details.
So I have a strongly typed edit view for one of my objects, everything works great until I try to put a dropdownlist on the view with an ID that does not match a property of my class.
I have this
[code]....
My expectation is that in the controller action that accepts the POST, I will manually use the FormCollection[] to read out that ID and populate MyOtherModel with the correct ID.
How much time is spent compiling a view in ASP.NET?Of course I don't expect anyone to give me a number, but I think it's interesting to have an idea of how much time this takes because it could influence the way we implement things.For example, if the time is significant , then I might try to put every result that I need to display in the view in a model class instance (created just to hold the values in such a way that I don't even have to test for objects with null value) and then minimize to the maximum (uh?) the amount of C# code in the view thus decreasing the amount of time necessary to compile the view.Question Does this make sense? Give some thoughts on this one.
is it possible to do a batch update in a strongly typed data set? UpdateBatchSize does not seem to be an option once you create a strongly typed dataset.
I'm currently working on a 3-tier ASP.NET application (UI, BLL & DAL). The DAL uses a strongly typed dataset that I've created with the VS Dataset Wizard. My question is, what is the best way to handle exceptions originating from the BLL and DAL classes. I googled a bit and it seems that the most commonly used practice is to create DALException and BLLException classes and throw your own message. Is this the way forward? how this can be done for an automatically generated DAL? What are the best practices?
Can my strongly typed view use a generic with a constraint? The type I want to pass to the view is
RoleGrantedToPerson<T> where T: Aggregate I don't know what T is at design time, only that it is a child of the base class 'Aggregate' I have tried using
Im trying to get my strongly typed master page to work in my ASP MVC 2.0 application.have come far with the help of these two posts:Passing data to Master Page in ASP.NET MVCStrongly Typed ASP.Net MVC Master PagesProblem is that im not sure how to get that ViewDataFactory code to work, this is my code:
BaseController.cs public class BaseController : Controller { private IPageRepository _repPage; public BaseController(IPageRepository repPage) [code]...
I am working with a third party asp.net application that uses master pages and nested master pages. My needs are to dynamically set the master page files for each page(.aspx). The application by default sets the master page file in the strongly typed @Page directive for each page. I don't want to change the strongly typed directive on each page (over 50 pages) because I am lazy and I want to minimize conflicts with future upgrades.
I am not sure why this happens, but when I have an Html.TextBoxFor(model => model.SomeObject.SomeProperty), when I post, the property of that object is always null.
When I look at the markup generated, I see <input type="text" name="SomeObject_SomeProperty" id="SomeObject.SomeProperty" value = "" />
If I change the helper to Html.TextBoxFor(model => model.SomeObject.SomeProperty, new {id = "SomeProperty"}) the controller is then able to pick the value up. Why is this happening? I feel as though I shouldn't have to be specifiying the id for the textbox as it works when fine when not using child objects on a view model, IE <%: HtmlTextBoxFor(model => model.SomeProperty) %>.
In my Index() function, I have a query which is joining multiple tables. How do I transform this query into the object model which I am going to use in my view?