Click here to Skip to main content
15,887,083 members
Home / Discussions / ASP.NET
   

ASP.NET

 
Questionhow to do a a parody album management ASP.NET application Pin
kushaochin2-Nov-15 21:30
kushaochin2-Nov-15 21:30 
AnswerRe: how to do a a parody album management ASP.NET application Pin
OriginalGriff2-Nov-15 21:32
mveOriginalGriff2-Nov-15 21:32 
GeneralRe: how to do a a parody album management ASP.NET application Pin
kushaochin2-Nov-15 21:43
kushaochin2-Nov-15 21:43 
GeneralRe: how to do a a parody album management ASP.NET application Pin
OriginalGriff2-Nov-15 21:49
mveOriginalGriff2-Nov-15 21:49 
GeneralRe: how to do a a parody album management ASP.NET application Pin
Richard MacCutchan2-Nov-15 21:53
mveRichard MacCutchan2-Nov-15 21:53 
GeneralRe: how to do a a parody album management ASP.NET application Pin
kushaochin2-Nov-15 21:56
kushaochin2-Nov-15 21:56 
GeneralRe: how to do a a parody album management ASP.NET application Pin
OriginalGriff2-Nov-15 22:03
mveOriginalGriff2-Nov-15 22:03 
QuestionMVC, populating a dropdownlist, values persist on postback, and setting the value. Pin
jkirkerx2-Nov-15 12:16
professionaljkirkerx2-Nov-15 12:16 
That was a mouth full, I can't figure it out. This is my first Dropdownlist in MVC 5 and Razor

So I can get the Dropdownlist to load the values, but if the edit fails, the values don't persist. I'm sure I don't have to load it again in ActionResult with HttpPost.

I can't figure out how to set the value on edit or page load.
And I'm not sure if the value is picked on on postback, but I'll work on that part now.

So here's what I have now.

[Model]
[Required]
[Display(Name = "Security Level")]
public IEnumerable<System.Web.Mvc.SelectListItem> AdminSecurityLevels { get; set; }
public int SecurityLevel { get; set; } // Not in use yet, but i think it's required.

[Controller]
public ActionResult UserEditor(int? userID)
{
  IEnumerable<SelectListItem> securityLevels = SelectListHelper.GetAdminSecurityLevels();
  ViewBag.AdminSecurityLevels = securityLevels;
}

[View]
<div class="form-group">
  @Html.LabelFor(m => m.AdminSecurityLevels, new { @class = "control-label" })
  @Html.DropDownListFor(m => m.AdminSecurityLevels, Model.AdminSecurityLevels, new { @class = "form-control" })
</div>

And a [Class]
public class SelectListHelper
    {
        public static IEnumerable<SelectListItem> GetAdminSecurityLevels()
        {
            IList<SelectListItem> items = new List<SelectListItem>
        {
            new SelectListItem{ Text = "Select admin security level", Value = "--"},
            new SelectListItem{ Text = "5 - Super Administrator", Value = "5"},
            new SelectListItem{ Text = "4 - Management", Value = "4"},
            new SelectListItem{ Text = "3 - Website Operator", Value = "3"},
            new SelectListItem{ Text = "2 - Field Employee", Value = "2"},
            new SelectListItem{ Text = "1 - Demonstration", Value = "1"}
        };

            return items;
        }
    }

AnswerRe: MVC, populating a dropdownlist, values persist on postback, and setting the value. [Sort of Solved] Pin
jkirkerx4-Nov-15 7:26
professionaljkirkerx4-Nov-15 7:26 
QuestionLosing the content of file upload control on postback Pin
Member 114228682-Nov-15 1:09
Member 114228682-Nov-15 1:09 
AnswerRe: Losing the content of file upload control on postback Pin
Richard Deeming2-Nov-15 2:19
mveRichard Deeming2-Nov-15 2:19 
AnswerRe: Losing the content of file upload control on postback Pin
F-ES Sitecore9-Nov-15 5:08
professionalF-ES Sitecore9-Nov-15 5:08 
QuestionFloor Plan in Web Application in ASP .NET Pin
Member 77075161-Nov-15 21:42
Member 77075161-Nov-15 21:42 
AnswerRe: Floor Plan in Web Application in ASP .NET Pin
F-ES Sitecore2-Nov-15 0:28
professionalF-ES Sitecore2-Nov-15 0:28 
QuestionCheckbox with enable and disable function. Pin
Praveen Kandari30-Oct-15 20:07
Praveen Kandari30-Oct-15 20:07 
QuestionGetting error when I try to load report in ASP.Net application Pin
Member 1209746129-Oct-15 2:15
Member 1209746129-Oct-15 2:15 
Questionsession related issues. Pin
Member 1191972228-Oct-15 19:16
Member 1191972228-Oct-15 19:16 
AnswerRe: session related issues. Pin
F-ES Sitecore28-Oct-15 23:18
professionalF-ES Sitecore28-Oct-15 23:18 
GeneralRe: session related issues. Pin
Member 1191972228-Oct-15 23:42
Member 1191972228-Oct-15 23:42 
GeneralRe: session related issues. Pin
F-ES Sitecore28-Oct-15 23:58
professionalF-ES Sitecore28-Oct-15 23:58 
GeneralRe: session related issues. Pin
Member 1191972229-Oct-15 0:04
Member 1191972229-Oct-15 0:04 
GeneralRe: session related issues. Pin
F-ES Sitecore29-Oct-15 0:13
professionalF-ES Sitecore29-Oct-15 0:13 
GeneralRe: session related issues. Pin
Member 1191972229-Oct-15 19:38
Member 1191972229-Oct-15 19:38 
GeneralRe: session related issues. Pin
F-ES Sitecore29-Oct-15 22:23
professionalF-ES Sitecore29-Oct-15 22:23 
GeneralRe: session related issues. Pin
Member 1191972229-Oct-15 23:29
Member 1191972229-Oct-15 23:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.