Create dropdown using ASP.NET MVC4 and Entity Framework is used for database - asp.net-mvc-4

I want to create dropdown list using ASP.NET MVC4 and Entity Framework is used for database connectivity.
Problem is that I want create a new department name item in this dropdown list when click on it a javascript prompt is open with text box and ask for new department from end user. where he/she can add new department with his own desire and this is store in database and show in dropdown list after save.

Related

asp.net mvc dropdown view bag

I have created a dropdown in asp.net MVC which contains paid accounts, trial accounts and all accounts, but when I click on any one of these options, it should display accounts related to that specific category in the data table but there is no response when I click on any of these options from the drop-down, I mean those accounts are not getting listed.
possible reasons for your problem
Drop down is not populated with proper integer values
On select of drop down item , appropriate item value is not used to fetch accounts

How to populate active directory data into a sharepoint list form

I have one custom list with fields like(IDs, Name, Phone no) . when i add a new item to the list a new item form will be opened. While filling the form by entering the first field( IDs), i want other fields to be auto-populated from active directory.
Can it be possible through Browser(UI) or from sharepoint designer.
Please Help me out ...
Yes this is possible I have implemented something very similar.But this is only possible through event receiver in a custom list.Following was my approach,
Add a ItemAdding event receiver, only field entered by the user will be the UseraName field through people picker.
Internally,fetch the details of the user entered from AD.This can be done through code in this way,
http://www.aspdotnet-suresh.com/2011/03/how-to-get-userdetails-from-active.html
Then you can assign the user properties to their respective columns and update the list item.
If its not a custom list,you can always use User Profile Synchronisation by Mapping additional required AD properties so that they will show up in the user information list of that sitecollection.
You can use sharepoint user profile. So instead of going back to AD related stuffs SP profile will get automatically synced with AD. Its very easy to manage also.
If it's a different AD than the one you use for user profiles, then you will need to develop a custom WebPart and write server code to connect to the AD and check for user's info & auto-populate them.
If it's the same AD used for user profiles, then you already have different users properties on the SharePoint side and no need to reach out to the AD... this is assuming that you already have a User Profile Service Application setup and it's synced with AD (as #samh above suggested).

Custom ASPX Form whats the better way

I have developed a portal using SharePoint 2010 (Standard Edition). I want to develop a Master-Detail "Requisition" form using Visual Studio 2010. I don't want users to access the List and click on "Add New" to access the form. I want to create a link on portal's homepage like "Requisition Form" when user will click on the link it should open the form right there.
Should I create a Visual WebPart ..then create new page and embed the webpart there? or should I develop WebPart Page..I've never done webpart page so what's the better approach? and to Edit the page do I need to create another Visual part with Gridview control and fill currently logged in user's Requisitions including Item ID and pass it on to MyCustomRequisitionEditForm.aspx ?
Please advise.
Why don't you customize standard new form of the list with Sharepoint Designer or InfoPath? You can create a link to this form on the homepage of your portal.

Set the value of Infopath field from aspnet dropdown list control in sharepoint 2010 site

I am developing a helpdesk system on sharepoint 2010 for our facility management dept., through which the call agent can log the client's complain through tickets. I have created 3 dropdown lists (asp.net controls from sharepoint designer) in the helpdesk page, reading repectively from our database the "projects", "properties" and "units", and the call agent will select the appropriate choice accroding to the client.
I have created a custom list, it is the helpdesk tickets, and edited its layout in infopath 2010.
I am displaying that list on the same page, but filtered according to the selected unit from the "units" dropdown list, to display the tickets history for that particular unit.
What I need is to set the default value for the "unit" field in the new ticket after the call agent clicks "add new item", to be the value selected in the "units" dropdown list.
I have tried a workaround, by removing those 3 controls and creating a new custom list and called it "engine", and edited its form to have the 3 dropdowns, then adding it as a data source for the ticket form, and displaying the "engine" form on the page.
The value of the unit was passed succesfully, but of course I have to click "save" after I enter the choices for the three dropdowns in that "engine" form for the value to be saved and passed to the "new ticket" form. also it was so much slower and the history filter was not working.
So I need to return to the first solution and keep the 3 asp.net dropdowns, and pass the sleected value of the "units" dropdown to teh "unit" field in the ticket form.
Thank you all in advance :)
I don't think it's possible to inject values into an IP Form. However, consider this workaround:
You create the "projects, "properties" and "units" dropdown's within InfoPath and then map this properties to the SharePoint list. This way, you can still apply SharePoint's default filter/group by/etc behaviour and you actually don't need to code anything yourself :-)

SharePoint 2010 custom display form like publishing page?

I want to display a list item in a different detail page, not dispform.aspx, not in modalbox. Page must be inherit site masterpage, layout page and must be in portal sitemap like publishing page.
Breadcrumb must be like this:
Company Intranet > Announcements > Product request formm updated!
Is there any way for do that?
Chaning the System Master to publishing master page will render all the forms with Same UI as you see in Home page.
You can change it in this Location http://yousite/_layouts/ChangeSiteMasterPage.aspx You have to do this in site where you what to see this change.
To Prevent the popup forms Go to List Settings->Advanced Settings and turn off the Dialog.
Also to change default Form of List you have multiple forms
Create a New Form (Link is for 2007 same applies for 2010 as well) in SharePoint Designer and Associate it to the List.
Use Infopath to create a Custom Form
Develop a new Webpart that will do Add Edit etc and Add it to the Default Forms.