MVC :: Create Differents DisplayTemplates For The A Type?
Apr 20, 2010I want to create two differents DisplayTemplates for the DateTime type, One for Births other for time span:Post (2 minutes ago)Rafael Almeida, 22 years.
View 3 RepliesI want to create two differents DisplayTemplates for the DateTime type, One for Births other for time span:Post (2 minutes ago)Rafael Almeida, 22 years.
View 3 RepliesI use MVC 2. I'm trying out the sample gave out in tutorial video. I put for example String.ascx in Views/Shared/EditorTemplates.
[Code]....
and lastly in Views using Html.TextboxFor(c=>c.Name)
I also tried to use EditorTemplates in Views/Customer/EditorTemplates folder, creating Customer.ascx and use Html.EditorForModel(). But the output still the same.. no red background in Name textbox where it supposely to have. And in generated html output no background style is written to it.
I have been design a site it is started nice in explorer but it is not nice I mean it different from IE (borders and alignments) in opera and some other browser. How I can set my site to load by all browser ?
I use asp.net to design pages. net framwork 4.0
I'm working on a MVC3 application and I created my POCO classes from my database with the DbContext Code Generator. All goes fine until I got stuck in this situation. Note that I use the repository pattern and I use for every entity a dedicated repository that every get a new instance of the DbContext.
Now, I'm in this situation:
object A has a relation one-to-many with B (A can have one or many B)
object B has a relation many-to-one with C (C can have one or many B)
object B has a relation many-to-one with D (D can have one or many B)
I should add a new object B, consider that object C and D are yet existing, so I must only do the relation and the object A can be created or updated. In the specific consider that A is customer and B is subscriptions (C and D are virtual objects properties
in the B).Now If I try to save I got duplicates in C and D tables, while the management of the object seems to work.
Here's the code: [Code]....
And here the add and the save method of the customer repository: [Code]....
Should I check for every relation and modify the state of the entry to Unchanged or something like that ?
I defined a few display templates for classes and they work well when I put them in views/shared/DisplayTemplates. However after I move them into an area, looks like ASP.NET MVC won't look inside Area to find the templates. How to reference the DisplayTemplates defined in an Area from main project? Is that a good practise?
View 1 RepliesI'm trying to create a validation layer that will contain methods to validate all my objects (in my Business Objects layer) .. but when I try to reference both the validation and business objects to each other I get a circular dependency error .. so I've decided to create a new layer (BLL) to validate the objects for me and I'll be able to reference both the validation and the object layers.
so I want to build some kind of class/interface -I don't know what fits more- to be like a generic type or a parent type that my method could accept it as a parameter and check for it's Name/ID property. Instead of defining a new method overload for each object type I have
Simplification
How would I create an instance of a type if all I have is the type in string form?
[Code]....
Now if I wanted to create and instance of myType how would I do that ?
I am struggling to find relevant documentation on this, what I basically want to do is to create a 'hyperlink' type and a 'pdf' type that I can put into my XML file and use to link to a webpage or a PDF, with the relevant icon.
Here is my JQuery :
[Code]....
And my XML :
[Code]....
Bit of a puzzler, I have a generic class
public abstract class MyClass<T> : UserControl
{
}
and I have got a type like this
Type type = Type.GetType("Type From DB as String", true, true);
and I want to create and instance of MyClass using the type... But this doesn't work.
MyClass<type> control = (MyClass<type>)LoadControl("/UsercControl.ascx");
I have a function that at the moment takes a Type variable. This function sticks it in a list and such and eventually needs will create a class of that type. Right now I do that with
object o=MyType.GetConstructors()[0].Invoke(new object[0]);
which is pretty hacky and also will not work in medium trust due to reflection(I think). Is there a better way of doing this without reflection? The Type is defined this way as part of a function. I need the class to be created "lazily" because it may not be created in the application if it's not needed. I use it for example like
AddToList(typeof(Whatever));
Note, I'm open to suggestions on changing the function calling. I just need the object to be created lazily and for to store the type(or however to create an object of the type) in a list.
I want to create the structure like following 1. Main Area 1 A. Sub Area 1 B. Sub Area 2 2.Main Area 2 A. Sub Area 1 B. Sub Area 2 Whenever I will click on main area or sub area it should re-direct to that page and also, if add new area in database it should reflect in the structure Also specify me whether should i use sitemap for this?
View 1 RepliesFor my project, i have designed a login page like gmail.
According to the credentials given by the users the application should send to the corresponding pages asigned to them.
I can select IQueryable<object-type> data fine from a data repository class and push it into a list type MVC view, but how do I do this and group that data - I don't seem to be able to find any examples on this.
View 9 RepliesI am trying to create a type of table on sql 2008. The following sql fails saying Incorrect syntax near the keyword 'AS'. what i am doing wrong as this looks fine to me.
View 1 Repliesi am making a forum application using MVC 2. I have a ForumController which has Index and Create Actions. The Get Create Action returns View and the Post Create Action takes an argument of type "ForumEntry". When i generate create view i make sure that i check "create strongly typed view" and i select models.ForumEntry Model and NOT the models.Forum Model. The Forum model is ADO.NET enitity model that maps to Forum Table. I want to catch ForumEntry type into my Create Post action but mysteriously i get a Forum Object. I have verified this by returning Content When :
[HttpPost]
Public ActionResult Create(ForumEntry entryToCreate)
{
return Content (entryToCreate.Title); // No Output
}
When
[HttpPost]
Public ActionResult Create(Forum entryToCreate)
{
return Content (entryToCreate.Title); // output == new entry that i typed in the create form
}
I am baffled as the create Form is of type FormEntry. Here is the code for create View
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<Aspforum.Models.ForumEntry>" %>
i have a movie object and the movie have comments collection inside it
public class Movie
{
public List<Comment> Comments{ get; set; }
}
so i have a strongly type view like this :
public ActionResult Details(int id)
If I have a View for 'People' and a View for 'Company' and each has an associated list of 'Orders', should there be a separate view for each? Such as /People/Orders and Company/Orders, or should I simply have a single /Orders views and pass in some parameters?
View 9 RepliesI am working on an application that has two tables (amongst others) that are related by a Guid Foreign key. The parent table for this guid key is the aspnet_users table and the child table happens to be my employees table which has amongst other columns EmployeeID, FirstName, LastName, EmployeeType, NationalID etc. ant the referenced UserId column from the parent table. I have managed to get the dropdownlists (for UserId and Employee Type) displaying in my create view but have failed to have it create an employee since the guid value from the Dropdown list for UserId cannot bind when posting the form data. I am using Entity Framework 4 , VS 2010 and .Net 4
View 6 RepliesI'm trying to create a website that allows the user to type something up and it gets stored into a database. I'm looking to give the user some control as to different formatting such as for decorations, weight, style, etc... Also I want to keep the spaceing the user inputs into the text area as well (if the user presses enter to create a blank line). Is there a control out there that would let me do something.
Pretty much what I'm thinking of is something like what you would use to create a thread on a forum (Like what I'm using as I type this), where I get to choose the font style and such.
I am just planning to create a blog type of web application. But i am not understanding how do i rewrite url's? say suppose site is xyz.com then when some user registers with name of T then he can visit blog at T.xyz.com? As you can see the url's will keep on changing dynamically.
I don't want to keep creating sub domains for each new user joined on the site. How can i achieve this?
My web service works fine on my local machine but when i put it on the server it throw this error:
Parser Error Message: Could not create type 'Service'.
I don't know how to fix this.
How can I create FB and gmail type web base chat in Asp.net ....
View 1 RepliesI have deployed my webservice in server it shows the error like "Parser Error Message: Could not create type 'WebServiceFB'" ....
View 1 RepliesI'm just started with MVC3 and have the following error when I want to run my application :
An error occurred when trying to create a controller of type 'SignInMVC3.MenuController'. Make sure that the controller has a parameterless public constructor.
This is my MenuModel code
[Code]....
This is my MenuController
[Code]....
This is the code of my LoadMenu.asx (view usercontrol)
[Code]....
And this code is in the site.master page where I want to render the menu
[Code]....
I want to create a function which would have two parameters
public **XYZ** GetOputput(string strToConvert, **ABC**)
What I want from this function, that I will send a string to this function and the datatype in which I want to convert this string [Ex: Int32,Int64, datetime etc..] and the return will be the same as the datatype I have sent as the input parameter.
I want to have something like this in my function:
[code]....