MVC :: HtmlDropDownFor / Create A View To Create A New Meeting For An Association?
Sep 21, 2010
I want to create a View to Create a new meeting for an association.I create a view model because I want to be able to choose the members who will participate with a dropdownList displaying a string composed with their Family name and first name.
So I build a property which return a Dictionary and I want to display the value (Family name concatenated with the first name) and be able to processed the Member Id in the Post.
Where It's not clear at all is the code of the view with the => notation.
Here is my code for the ViewModel:
public class DistributionViewModel { public Distribution LaDistribution { get; set; } private Dictionary<int, String> _listeMembres; public Dictionary<int, String> ListeMembres { get {) Membre[] lesMembres = Membre.Search(null, null, null, null, null, null, null); //Search hit the database(I used codeAuthor) foreach (Membre m in lesMembres) //And with null it return all the members not filtered { string nomPrenom = m.Nom + "-" + m.Prenom; _listeMembres.Add((int)m.IdMembre, nomPrenom); } return _listeMembres; } } }But for the View where probably I should be ashamed about what I wrote!:</asp:Content><asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"> <h2> Creation d'une nouvelle distribution </h2> <% using (Html.BeginForm()) {%> <%: Html.ValidationSummary(true) %> <fieldset> <legend>Distribution</legend> <label for="DateDistribution"> Date de distribution:</label><br /> <%: Html.TextBoxFor(Model => Model.LaDistribution.DateDistribution) %> <%: Html.DropDownListFor(m => m.ListeMembres.Values, new SelectList(Model.ListeMembres), "[ None ]")%> <p> <input type="submit" value="Create" /> </p> </fieldset> <% } %> <div> <%: Html.ActionLink("Back to List", "Index") %> </div></asp:Content>If someone could helpRegardsAlain
View 8 Replies
Similar Messages:
Mar 6, 2010
I,am trying to create a self association relation for an organization chart data tree in Entity Framework,after trying different ways for prevention of exceptions like 3007 and etc. I found that when I put my foreign key in my POCO near Parent and Items navigation properties its work.but I think this is not correct that we have both ParentID scalar property and Parent navigation property. review this and tell me is it correct or not.I'm using VS 2010 RC and ofcource .net framework 4.0 RC
[Code]....
View 2 Replies
Oct 19, 2010
I am trying to use a partial view for a file upload in a Create View.
Here is my partial view, I removed the submit button, as the view it is rendered in, should activat the form post:
@model dynamic
View 1 Replies
Jan 27, 2010
Can i create a partial view and a controller that will feed data to the view, and if i render that partial in a Master page, the Data will show on whatever URL i am?
Or is there another way of showing content from database on every page(view)?
View 2 Replies
Feb 22, 2011
I'm rather liking this MVC3 and Razor way of working and I'm learning the ropes. I was wondering, can I create a partial view and pull it into another view in the following scenario:I have a "Person" model and an "Address" model. The Person contains name, phone number etc and each person has an address. I've created my Person "Create" view and that works fine but I now want to pull in my "Address" partial view to it.
View 10 Replies
Oct 1, 2010
how to create week view,day view in asp.net
View 9 Replies
Jun 10, 2010
I want to create a dashboard view using C# in ASP.NET.
View 8 Replies
Mar 30, 2011
How would i create a details view that also contains a list?
My aim is to have a details view that displays information about a person and then have a list on the same page that displays facts about that person.
Currently, my details view is working fine. I just need to add the list part. The details view inherits Models.MyViewModel which is a custom class as the details come from multiple tables.
View 1 Replies
Oct 12, 2010
In my controller method, I'm trying to create an instance of a View (cshtml file) before I wrap it around an ActionResult and return it.Since there is no "class" for Razor Views to speak off, how does one go about creating an instance of a Razor View?
View 25 Replies
Jan 11, 2011
Alright so I want to create a form, where the text in the textboxs will be sent to my database, after the user hits sumbit. The problem I am facing is i am used to using a detailsview or formview to do this for me, but how can I do this myself, where I manuelly update my database.
View 1 Replies
Jul 7, 2010
I have a Company model and an Employee model and I want to create a Company and then create multiple employees for the company in one view.
How should I do this in the view?
And what should I do in the Create POST method to support this multi-entry view?
View 4 Replies
Aug 28, 2010
How i can create a new view on code (on runtime) if this view dont exits?
View 5 Replies
Feb 22, 2011
I want a view that contains 2 partialviews. 1 partial view should be a create or edit view (of items) and in the second partial view there should be a list with the items that are created (and which can be edited). When an item in the list is selected for editing the 1st partial view should show the edit view with the item to be edited.
After saving the data, the create view should be shown in the 1st partial view again. When the view comes up for the first time the 1st partialview should contain the create view. In normal ASP.net I would do this with a formview (with insert and edit mode based on the itemselected in the gridview) and a gridview (and of course everything in an AJAX update panel).
View 2 Replies
Jan 10, 2011
I want to dynamically create textboxes ,forms and button...according to the input from xml...thru c#.....No idea about how to proceed....??any guidance?? eg:
<form>sdasa</form>
<textbox>username</textbox>
View 2 Replies
Dec 2, 2010
We have a database having 40 tables with 10 to 15 columns.When I try to execute stored procedure it will take 3 to 4 mins. I am not using synonyms,views and indexes. Now I want to create them
View 1 Replies
Mar 14, 2011
I want to create a view dynamically from a description of the view stored in an XML document. Ideally the view should be created using XSLT. The XML will describe what data items (properties of an object) to display, what kind of control to use and what the rules for validation are.Since I don't have a clue how to achieve the dynamic creation of a view or of a part of it, I would be glad
View 2 Replies
Nov 11, 2010
I have class as such:
[Code]....
and a class called ReportSource which contains a List<ReportSection> sectionList, and an instance of that ReportSource class is passed to the view to display each table within the list of DataTables.
What I'm trying to accomplish is generate a TextBox in the View for each DataTable displayed, where the user can enter some comments in each of those TextBoxes, and then store those comments in the comments field of ReportSection.
I have a loop in the View as such:
[Code]....
View 2 Replies
Dec 29, 2010
i have in database following tableUSERS,GROUPS,MENU,MENU_ACCESSafter user login he caan type in address bar then he navigates to pages URL in menu tablei need to check if user is authorized upon his group if not authorized he will be redirected to not authorized pag
View 1 Replies
Mar 3, 2011
I am creating a web application using ASP.Net 3.5 MVC , I have created Edit and Create views, one of the fields is Image URL,How can I upload a image in a web server folder and save the name of image in database (as a part of Edit and Create view)?
I have added following code in Create/Edit view:
[Code]....
View 5 Replies
Feb 26, 2010
When I try to bind code that calls a stored proceure as a List to a view I get :-
The model item passed into the dictionary is of type 'System.Collections.Generic.List` but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable`
How do I create the view if I want to bind a List<stored_procedure_name>?
View 9 Replies
Feb 10, 2011
am trying to create view form in my MVC2 applicationIn this i have a submit button which is an imagebut when i try to run it shows a normal windows button the image is not shown(the image is a round edged).the code is as below:
<input type="submit" value="Log On" id="login_button_75" />
#login_button_75 {
background:url(images/login_submit_button.png) no-repeat;
height:28px;
width:75px;
background-position:center;
View 6 Replies
Jun 20, 2010
I'm trying to build a Create view in which some fields for the model have been set in the controller and are non-editable. Take for example a post in these forums where the subforum in which you post depends on which forum you're in currently.
I tried to do this by passing an id parameter to the Create action like this:
[Code]....
[Code]....
But somehow the subforum property gets "lost" along the way, but the submitted prop. stays there. I should note here that the subforum property is an entity key.
So in other words: how can I set a few properties before returning the view, and keep these read-only until postback??
View 3 Replies
May 18, 2010
Does anyone have a Tabular create and details MVC 2 Template that i can pop into my project and use, instead of the ugly linear templates that come out of the box in MVC?
Are there free MVC view templates anywhere on the internet?
View 3 Replies
May 25, 2010
I want to link to a MVC View from my code-behind in a Webform, but I can't figure out how to do it and I have googled for an eternity :(
View 3 Replies
Mar 14, 2011
I want to create an html file to send as an outlook mail in which i want to show 4-5 reports. In whicn if i click on first tab i can see report 1 and if i click on tab2, i can see the report 2 in same frame. I created same using javascript but that is not working in outlook mail. I tried CSS but I am able to view them using hover effect only not on onclick.
View 4 Replies