I have a aspx page. Users can perform an action on that page. but that actions goes through series of other actions. for example- suppose there is JOin Community link on that page. When user clicks He is asked to Login/Register(A) THEN He is asked to fill up a brief profile(B) THEN he is asked to join community as member/admin etc (C). So there are 3 actions. ALL are to be done on popups/model dialogs (user remains on same page). and I want to create separate controls/pages for all of these steps for reusability.
I dont want to write HTMLS/server side code of all steps-A, B, C on page itself and I want proper interaction of all model dialogs with page so that depending upon his actions I can decide to show him B C or D dialog box anytime. Suppose user fills some invalid information on step B I should be able to show him step B again after all databse checks with a proper error message so that he can continue from same point where he made error.
Trying to put multiple dialogs on one page - they need to be able to come up more than once. I'm using ASP.NET so the ID's of the content to go in the dialogs are mangled. All of the examples for bringing up the dialog multiple times seem to work with getting the initialized dialog back the second time by using the contents ID.
I see a couple of possible solutions but they seem like hacks:1.) Store the .net mangled ID in some other field when I first bring up the dialog, and use that the second time around.2.) Use the dialog events to put the contents of the dialog back into its original location in the dom when the dialog is closed.
<ol> <li><div id="dotnetmangledjunk_Meaningful">stuff to go in the dialog</div></li> <li><div id="dotnetmangledjunk_Meaningful">stuff to go in the dialog</div></li> </ol>
I want to create method in web application ASP.Net + C# to take as input parameters PDF files paths then print all of it without showing Selection printer dialog so it print using default printer
1.) Have created a div with a dropdown list and ok, cancel button
2.) On document ready - registering div created on step 1 into a jQuery dialog
3.) on a javascript button click - I am opening this dialog box.
4.) Now, the problem is - the jQuery dialogbox which I have created, needs to be used by other button clicks as well on same page. Now, my div's (which is a dialog at runtime using jQuery) ok button click is already engaged with a javascript function (button1 click) and I can not associate other button's click events with it - thus stuck up here and have no clues or hit to resolve this.
I'm building a web application that has a particular model representing some events. Users need to be able to add N number of people to a given event. Choosing people is handled by a partial view.
I'm trying to build a menu that displays when users click "add a person" to the event. Because the event hasn't been filled out completely yet, there is nothing in the database to persist between requests.
I also have validation logic on the event page.
My proposed solution is to add the form to search or add for people on the event form itself and have a submit button that sends the values that have been added back to the server, where I can store them in ViewData or Session.
Unfortunately, doing this flags the validation.
My second solution is to load a partial view responsible for loading the UI to add/search for a person. I could add a little code on the method in the controller that returns a partial view storing the existing data in a session variable or viewdata. Trouble is, I have to submit the form to do it--again tripping the validation!
I'm wondering if perhaps I chose the wrong tool to do this...because in webforms, there would probably be a postback and you would just perform an operation on that postback. I'd like to avoid rewriting the application in webforms and am wondering if there are ways I'm overlooking in ASP.NET MVC.
The first user control in the view is just to validate the customer and get some more details about the customer. This control is having one text box (customer name) with the button. When the user clicks the button it should validate the customer name in the client side using data annotations of customer model. if validation success then it should use some bussiness logic to verify the customer and show the customer details on the form.
The 2nd user control in the view is to get the address of the customer by searching for the house no and the postcode. This control is having 2 text box with the button.
The first user control is based on the strongly typed customer entity
The 2nd user control is bsed on the strongly typed address entity
The view with both the user control is based on the strongly typed order entity.
The issue here is with the validation. I have the validation summary in the view and client sider validation is enabled. When i click the search button on the first user control the client validation starts and throws validation error messages because when i search for the customer at that point of time i will not have values to may of the customer related fields in the order view.
The same thing happen when i click the search button on the 2nd view. It will throw client side validation for other fields.
What i want to achive is that when the user click the search button on the user control 1 then the validation should happen only to the customer name field (both in client and server).
When the user click the search button on the 2 nd user control the the validation should happen only for houseno and the postcode both in client and the server.
When the user clicks the save button on the order view all the fields in the form even the controls usere input fields should get validated. How to achive this in mvc?
It's a multi-model view, and I'm achieving this through an IList<Book>. Each Book has a Title and an Author
So for example if I wanted to make 3 Books:
[code]....
However, I want to be able to generate such a form for any number of Books. I've done this before in Ruby on Rails through JavaScript and rendering partials, but I don't think I can render a partial in this case because the form changes (the index of the book has to increment for it to work)
EDIT: I'm looking for a way to do this in the Create view in particular. So in this case I don't have a list of books, but I'm building it.
A user should be able to click on a link that says "Add another item" and a form for another book should be appended to the bottom.
I have a parent View that uses a few partial views. Each partial view has its own custom model. The parent View is a model containing each of the partial view's model. In other words this parent View model is NOT flat.
How do i get POST data to bind with the parent's model object? Do i have to write a custom model binder?
Update I'm not binding to a collection of objects of the same type (ie: a collection of uploaded files). I'm binding to object that contains multiple of objects. For example:
I'm fairly new to all this, but have slowly been teaching myself C# and ASP.net MVC over the past year or so...I really tried to search for this, but haven't been able to find anything - it may be I'm using the wrong terminology!I'm using ASP.NET MVC2 with EF4 connected to a SQL Express db. Situation: Without getting into too much specifics, I have one table called 'Plan.' Under 'Plan' are several different categories that are related to a single Plan item [say Category A, Category B, Category C and Category D]. Each 'Category X' table has a beginDate, endDate and other details specific to that category.
I'd like to be able to create a summary page that combines all items from Category A, Category B, Category C, and Category D and sorts by beginDate - but only need a few of the columns [eg - begin/end date, name, id].
I am using MVC2 on VS2010 Express edition. I followed a post by Dino Esposito on UI with JQuery passing data to a dialog from strongly typed views. I can't make the dialog work with modal:true option.Here I have a simple page that includes RenderPartial for a dialog. The dialog is supposed to pop up when a button is clicked. However, if I include modal:true as one of the dialog options, then when the button is clicked nothing happens. The dialog does not pop up. When I remove modal:true from the dialog options then dialog pops up as expected and closed as expected.
I have a complex page with several forms on it. The page is divided into sections, and each section has a continue button on it. The page is bound to a pageViewModel, each section addresses a different set of properties on the model. The continue button makes an ajax call to the controller, and the model binder binds it appropriately to the appropriate sections of the model. The section is refreshed appropriately. Finally, I would like to have a save button at the bottom of the page that takes all the forms, and binds all of the forms to the model. The model, at this point has all of the properties filled out, and can be processed accordingly. Can I accomplish this by some ASP MVC magic?
I have one view page (MyView.aspx) and many data sources to bind on this page. Lets say it has Books, Publishers, Comments, etc. Each one of those has an object which provides a List, List, etc. In my view, what are my optiosn for multilple model biding? I want to check to see if each one is empty, and then enumerate it. But I can't check Model.Count() because wouldn't Model be made of all those objects if I set the page to inheriet from? What are my options? Should I load each content area in a control/partial view? Or can I just dump each object into ViewData and then check the count by casting in the view?
It should be simple; although I'm having a hard time to figure out the best way to do it. I've MVC2 pages with multiple forms on the same page having different functionalities.
What's the best way to handle this; including the MVC2 way of validation from the model?
This project I'm working on have this custom clientside JavaScript validation framework created for (which I cannot change) that show error messages/summary based on your data annotations and a "Validate" method in your ViewModel.
Like I said I'm not allowed to change this, so wont be able to go with suggestions doing that.
What the person that created this did not foresee, is that one might need put several partials of the same type and having the same view model (each in a form) on a view.
So I went ahead and did things the normal way (using Html.whateverFor<model => model.whatever) and wala!....the custom validation thing throws error messages for the specific form fields, next to each form in the view. I was suggested to create a "prefix" for each instance of the view model, and do something like this:
How to select more than one radio buttons and use model binding to attach the Roles to the model property public string []Roles?The difficulty i`m having is that though i`m having multiple rows, Only and only One radio button is selected and tha tof the last row. I have the following code:
I've got a div on Page A.When an event happens (whatever I define, a click, whatever), I do a div.Dialog, set its properties and open itThe data inside is returned from an async .ajax call that grabs the data from a url and appends it to the div by calling div.html(data) inside the .ajax callback, so it's essentially loading a PageB by getting the data (content) and appending it to the div that's calling the dialog("open")...nothing special here I don't think.
My question: In Page B, how do I reference the dialog so I can do some things to it? For instance in Page B's content that I received back from that .ajax call and added to the div via .html(data), there is a button and when clicked I need to close the dialog.Right now my buttons are not working inside the dialog because one of them closes out the dialog and the other should redirect to a new page but both do not work now because I have no reference to the dialog that it's in to manipulate it. So I need reference so I can close the dialog via some jQuery that will reside in PageB (data).
getting data from multiple Entities models into an MVC controller. Most of the examples I have seen for using EF in an MVC2 app only use a single entitiy.
I have just started using MVC2 in C# using the Entity Framework models (CIOps.model) created from an SQL database. I can create the controller and views using single tables of the model in MVC2, but I just cannot get my head around how to get data from multiple entity tables into the controller (similar to joins in T-SQL). I have included an example below of the controller code that works with a single entity table, tbl_tours (tbl_tour in DB).
Could someone please illustrate how this code would be changed to include additional columns from FK tables in addition to tbl_tours columns. E.g. the clients name from the tbl_clients, the coordinators name from the tbl_employees, and costs from tbl_costs entities? Is it possible to do this directly using the EF model entities/classes that are already created and not use LINQ, POCO, Repositories, etc.? The FK relationships are already in the EF models. I have included the whole controller code, but I just need a few examples of how to join the multiple entities, not rewrite every CRUD function function in the controller. I think this will get me over the hump in using EF in an MVC2 App. Also ignore the fact I am using the home controller, this will change in the application.
I recently started explore MVC and just tried some samples around, i.e. MvcMusicStore.
As the sample DB in MvcMusicStore is quite small, I am wondering how should I design the edmx/entity for a bigger database, let say for an enterprise application, which has more than 20 tables as in AdventureWorks?
Thus, the question is should I include all in one edmx/entity or I should include multiple edmx/entities when I designing the model?
one thing that has been puzzling me since learning MVC2 is the following case scenario: I have a view which contains two latest news lists, a login form and a signup form. Every example I found on Views and View Models so far has a one-to-one example such as a simple login form etc. But how do I create a model that provides the properties and validation for a login and signup form and manages the data for the news lists. can I pass multiple models in the strongly typed view? When I created one model the form validation would fail as it expects all fields - login and signup to be filled. I am missing some advanced examples or information.
I'm building an MVC 2 RTM app, and I want to be able to share my model across applications. I'd *like* to be able to implement it like:ASP.NET MVC2 app (holds Views and Controllers)Class library to hold Model(s)WCF app to handle the data transactions with the models via different data stores across apps I had the MVC app working fine, but I wanted to abstract the data stuff and be able to work with the model across apps through the WCF site, so I created a class library project and moved all of the Models classes into that and set-up a WCF app, then added project references to the MVC and WCF apps that point at the class library. The idea was I can create services that take and return objects from the model via method calls across apps. It appears that everything's wired up correctly in the MVC project, so I'm passing the objects stored in the Models class library between controllers and views and everythig is compiling just fine, but for some reason the data is not being passed back from the views to the controller on POST -- all of the properties in the classes are null or empty.
When I debug the app, I can see that the values are stored in the model data dictionary but not the model object itself. What am I doing wrong? Am I on the wrong path, or missing something obvious (to some)?
I made a few changes to the DB in SQL server management studio then right clicked on the .edmx doc to get it to update. That seemed to work fine but when i compiled the app everything that referenced the EF seems to be broken.The Error list now contains the below error for all classes that used it.
The type or namespace name '' could not be found (are you missing a using directive or an assembly reference?)
I have an issue of static variable in an asp.net application. Let's say I have a server with 8 CPUs running windows 2008 R2 hosting an asp.net webbsite, nothing fancy here, no funny configuration.
Is the following statement true? at any single time, there's one and only one process is running and accepting requests, even in the recycling stage. The reason I am asking is: I have a static field in my class, and I want to make that's the only static instance in the website. I've heard in some circumstances, IIS is recylcing your application, and it will start a new process, but the old process is still working, thus I will have 2 static instances in memory, which defeat the purpose of static field.
One step further, let's assume there might be 2 instances in memory, can I assume there are at most 2 instances at any single time? And can I assume once the second instance is up, the first instance will NEVER accept new requests?
Another question: Recently I have a problem with an applicationdomain concept. Looks like if an application domain causes a memory leak, unload the domain will not release the memory (Umanaged leak). So to what extent Application Domain is isolated?