UML and Patterns: An Introduction to Object-Oriented Analysis and Design and Iterative Development, that follows the UP(Unified Process). It uses a Grasp Controller pattern to interact with domain classes by some methods like NewSale(), AddNewItemToSale() and CloseSale. In windows form, I can instantiate a object of this class in the UI and then use its methods to perform the actions. This works well in Client apps, but when I use asp.net mvc, I cannot find a way to instantiate an object (one for each user) that was always visible for a Controller (MVC). I cannot insert as an attribute inside Controller because it always create a new one.
I've posted the same question in the Object Data Source forum. This is a link to it http://forums.asp.net/t/1554083.aspx. Maybe I should've posted here to begin with. There seemed to be some overlap so I wasn't sure which was the best on to post the question in.
I'm trying to get a better understanding of how I could've designed my app so that the Object Data Source could work with the properties of my business objects. Please read the other post to see how it's currently being done. Sorry for the link to the other page. I didn't want to post a bunch of duplicate information. I would love to get some suggestions for alternative ways of doing this.
Is it possible to change Properties of ViewData.ModelMetadata in Controller?. For example, can I do the following to change the display information of the LogOnModel:
[Code]....
When I do that there is no errors but DisplayName is not change. I'm trying to localize strings to different languages and also to make some attributes of the model different depending on users roles.
Using the Entity Framework in n-Tier ASP.NET Applications which write by julie lerman in section "Example 21.10. A TemplateField, which can be used for navigation properties".
When I run the application I get a Compilation Error "The name 'Databinder' does not exist in the current context" someone can tell me what my mistake?
I warking with EF 4 in vs 2010 with asp.net application. In my page I put detailsview which connet to objectdatasource. I want to bind navigate property to text in murkup like this:
<asp:TextBox ID="txt_legalStatus" runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"legal_status_codes.Term") %>'></asp:TextBox> according to this article (from o'reilly book)
Using the Entity Framework in n-Tier ASP.NET Applications which write by julie lerman in section "Example 21.10. A TemplateField, which can be used for navigation properties". When I run the application I get a exception "The ObjectContext instance has been disposed and can no longer be used for operations that require a connection" someone can tell me what its not working?
value 1 is checked but client click value 0 and save in the databasewhen page load . i have to make it value 0 to be checked instead of value 1 . because i am retrieving client saved data from data basehow should i bind radionbutton to be check..
Is it possible to insert information into the gridview's pager, like "Showing 10 of 55 items (You are on page 3)" and bind that information accordingly to the actual PageCount and PageSize properties?
I can only think of doing it outside the pager, even outside the GridView.
Idealy i would like to get a web-page that looks like the popup-windows that you get in Visual Studio when you click an object while debugging. So if the object contains any arrays, i'd also like to see what's in them, and for all those objects inside i would also like to be able to go deeper into those objects.
The reason i'm asking this, is that I can't debug my code locally (because it uses a web-service that will only run on the production), and I can't install Visual Studio on the production server, So i need to be able to actually debug on the production server. I can write my code locally though, and upload it to the production.
I have a 3rd party server side control that generates JavaScript and I'd like to see what methods and properties it exposes.Currently I just type in an invalid function like asdf123() so VS will break and I can add a watch to the variable, but there are a ton of methods and I don't know what I'm looking for (I'm trying to make the control do something undocumented).
I'm working on an application that uses an approach to localization where they just call a translate function for every piece of text on a page. It leads to a lot of redundant code that looks like this (psuedocode):
function page_load():
translateControlText(control1, language); translateControlText(control2, language); translateControlText(control3, language); translateControlText(control4, language); translateControlText(control5, language); translateControlText(control6, language); translateImageAlt(image1, language); 100 more lines of this on a single page
The application is massive, so I don't have the opportunity to rewrite the translation logic. However, I think I could just loop through all of the controls on a page, check their type, and translate the appropriate property. At least then I would just have to call 1 function per page, and then throw it in a base page or master. However, I probably wouldn't want to translate certain things, such as table cells. Regardless, there is an attribute called Localizable that is on many properties such as Control.Text and Image.Alt. I'd like to be able to get a list of every string on the Page that is stored in a Property marked Localizable. Is this possible? Is this possible without reflection?
I'd like to add some custom instance properties to an ASP.Net User object. for example, I'd like to log every user's login and have something like: User.LoginTimes or calculate the User Profile's Completion percentage and be able to access it like: User.ProfileInfoPercentage, etc.
Now What I'd like to know is what would be the best approach to do this?
Forget about user instances? (e.g. define a database table with userid and ProfilePercentage info and retrieve data from profile like: DB.GetProfilePercentage(Context.Current.User.UserID) ) Override the ASP.Net User class and add my own functionalities. Use Extension methods for the user class.
I am interested to know what happens with unused properties of a class when an object is instantiated?
Are there performance hits for having additional unused properties? What about complex properties that are accessing the database, but I'm not using them, are they still being loaded?
I am using ASP.NET MVC 2.0 and I want to transfer my ViewModel properties to business object. I can do this manually or use AutoMapper or use new method available in ASP.NET MVC 2.0. My question is that does anyone know the name of the new method which allows to copy the properties from one object to another?
In the past I've used UserControls to create email templates which I can fill properties on and then use LoadControl and then RenderControl to get the html for which to use for the body text of my email. This was within asp.net webforms.
I'm in the throws of building an mvc website and wanted to do something similar. I've actually considered putting this functionality in a seperate class library and am looking into how I can do this so that in my web layer I can just call EmailTemplate.SubscriptionEmail() which will then generate the html from my template with properties in relevant places (obviously there needs to be parameters for email address etc in there).
I wanted to create a single Render control method for which I can pass a string to the path of the UserControl which is my template. I've come across this on the web that kind of suits my needs:
[code]....
Does that make sense? I was just wondering if this is at all possible in the first place and how I'd implement it? I'm not sure if it would be possible to map the properties set on 'object' to properties on the loaded user control and if it is possible where to start in doing this?
I have advice that this might work for programmatically filling a set of literals from a set of object properties:-
[code]....
However, the line: ctl.Text = pageData.help(i).trim() fails because it's not understood that pageData.help(i) should translate to pageData.help1, pageData.help2, etc.
I have a WCF service that when the objects serialize to clients an extra property is getting added with a 'Speficied' suffix. At first I thought it had to to with a couple of nullable type properties, but it is happening to all of my value types even if it is not declared Nullable. How can I get rid of this?
I need to use this data as an input to ajax request. For eg. consider a dropdownlist change event, I need to pass these values to the controller.
sample code
//dropdown change event $("#TestReqID").change(function() { var id = 10; var testResults = "abc"; var inXML = "<xml>"; inXML = inXML + "<id>" + id + "</id>"; inXML = inXML + "<value1>" + testResults + "</value1>"; inXML = inXML + "</xml>" $.getJSON("/Home/UpdateTest/Json/" + inXML, function(data) { //success code goes here }); });
in HomeController
public ActionResult UpdateTest(string obj) { if (HttpContext.Request.IsAjaxRequest()) { /* Need to parse data in "obj" from ajax request */ IPTests test = _service.GetIPTest(Convert.ToInt32(id)); return new JsonResult { Data = new { ipTestId = "0", testResults = "" } }; } return View(test); }
instead of xml string is it possible to use javascript object like
I am writing a C# MVC5 internet application and am having some trouble getting the 'ApplicationUser' object in a controller that I have created.
Code: var userManager = new UserManager<ApplicationUser>(new UserStore<ApplicationUser>(new ApplicationDbContext())); ApplicationUser user = userManager.FindByNameAsync(User.Identity.GetUserId()).Result;
When I try to run this code, when a user is logged in, I am getting a null object for the 'ApplicationUser' user.