Click here to Skip to main content
15,884,836 members
Home / Discussions / ASP.NET
   

ASP.NET

 
Questionapplication development Pin
vijay145722-Feb-15 1:50
vijay145722-Feb-15 1:50 
AnswerRe: application development Pin
Richard MacCutchan22-Feb-15 2:54
mveRichard MacCutchan22-Feb-15 2:54 
AnswerRe: application development Pin
David Mujica23-Feb-15 9:05
David Mujica23-Feb-15 9:05 
QuestionHow can i import images from Windows forms application to Webapplication Pin
Nadir Muhammed21-Feb-15 21:13
professionalNadir Muhammed21-Feb-15 21:13 
SuggestionRe: How can i import images from Windows forms application to Webapplication Pin
Kornfeld Eliyahu Peter21-Feb-15 22:28
professionalKornfeld Eliyahu Peter21-Feb-15 22:28 
AnswerRe: How can i import images from Windows forms application to Webapplication Pin
loben325-Feb-15 2:20
loben325-Feb-15 2:20 
QuestionBrowsing problem Pin
Member 1144687821-Feb-15 9:38
Member 1144687821-Feb-15 9:38 
QuestionMVC - database table not created automatically Pin
jkirkerx20-Feb-15 11:06
professionaljkirkerx20-Feb-15 11:06 
I'm puzzled on why my database table is not being created.
Is it because you have to start with no database first, for the model code to run?

This is my first time adding a form view, model and controller, I guess I missed something, or don't fully understand how MVC works.
This is the model that I wrote.
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration.Conventions;
using System.Globalization;
using System.Web.Security;
using redCopper.App_Code;

namespace redCopper.Models
{   
    public class ContactContext : DbContext
    {
        public ContactContext()
            : base("DefaultConnection")
        {
            Database.SetInitializer<ContactContext>(new CreateDatabaseIfNotExists<ContactContext>());
        }

        public DbSet<UserProfile> ContactProfiles { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
            modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();            
        }
    }

    [Table("CRM_MESSAGES")]
    public class ContactProfile
    {
        [Key]
        [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
        public int ID { get; set; }
        public string Name { get; set; }
        public string Subject { get; set; }
        public string CompanyName { get; set; }
        public string EmailAddress { get; set; }
        public string Query { get; set; }
        public DateTime Date { get; set; }
        public bool MailingList { get; set; }
    }

    public class ContactModel
    {
        [Required]
        [Display(Name = "Name")]
        public string Name { get; set; }

        [Display(Name = "Company Name")]
        public string CompanyName { get; set; }

        [Required]
        [Display(Name = "Email Address")]
        [EmailAddress(ErrorMessage = "Invalid Email Address")]
        public string EmailAddress { get; set; }

        [Required]
        [Display(Name = "Message or Comment")]
        public string Query { get; set; }

        [Display(Name = "Signup for our mailing list")]
        public bool MailingList { get; set; }
    }

    public class ContactInitializer : CreateDatabaseIfNotExists<ContactContext>
    {
        protected override void Seed(ContactContext context)
        {
            base.Seed(context);
        }
    }
}

AnswerRe: MVC - database table not created automatically Pin
ramyajaya13-Mar-15 14:00
ramyajaya13-Mar-15 14:00 
GeneralRe: MVC - database table not created automatically Pin
jkirkerx16-Mar-15 8:11
professionaljkirkerx16-Mar-15 8:11 
Questionexport ms access data to excel Pin
Praveen Kandari19-Feb-15 21:39
Praveen Kandari19-Feb-15 21:39 
SuggestionRe: export ms access data to excel Pin
Richard MacCutchan19-Feb-15 23:35
mveRichard MacCutchan19-Feb-15 23:35 
QuestionExtra level of security need to be added using a SMS service(One Time Password two-factor authentication implementation Pin
bharat32119-Feb-15 1:52
bharat32119-Feb-15 1:52 
AnswerRe: Extra level of security need to be added using a SMS service(One Time Password two-factor authentication implementation Pin
ZurdoDev19-Feb-15 2:31
professionalZurdoDev19-Feb-15 2:31 
GeneralRe: Extra level of security need to be added using a SMS service(One Time Password two-factor authentication implementation Pin
bharat32119-Feb-15 2:38
bharat32119-Feb-15 2:38 
SuggestionRe: Extra level of security need to be added using a SMS service(One Time Password two-factor authentication implementation Pin
ZurdoDev19-Feb-15 2:42
professionalZurdoDev19-Feb-15 2:42 
QuestionLocalization - Unable to use any Actions from Pages in Navigation Bar if Arabic language is set Pin
RajeeshMenoth18-Feb-15 17:52
professionalRajeeshMenoth18-Feb-15 17:52 
AnswerRe: Localization - Unable to use any Actions from Pages in Navigation Bar if Arabic language is set Pin
Richard MacCutchan18-Feb-15 22:08
mveRichard MacCutchan18-Feb-15 22:08 
GeneralRe: Localization - Unable to use any Actions from Pages in Navigation Bar if Arabic language is set Pin
RajeeshMenoth18-Feb-15 22:28
professionalRajeeshMenoth18-Feb-15 22:28 
GeneralRe: Localization - Unable to use any Actions from Pages in Navigation Bar if Arabic language is set Pin
Richard MacCutchan18-Feb-15 22:37
mveRichard MacCutchan18-Feb-15 22:37 
GeneralRe: Localization - Unable to use any Actions from Pages in Navigation Bar if Arabic language is set Pin
RajeeshMenoth18-Feb-15 22:51
professionalRajeeshMenoth18-Feb-15 22:51 
GeneralRe: Localization - Unable to use any Actions from Pages in Navigation Bar if Arabic language is set Pin
Richard MacCutchan18-Feb-15 22:56
mveRichard MacCutchan18-Feb-15 22:56 
GeneralRe: Localization - Unable to use any Actions from Pages in Navigation Bar if Arabic language is set Pin
RajeeshMenoth18-Feb-15 23:02
professionalRajeeshMenoth18-Feb-15 23:02 
Rant[REPOST] Localization - Unable to use any Actions from Pages in Navigation Bar if Arabic language is set Pin
Richard Deeming19-Feb-15 2:25
mveRichard Deeming19-Feb-15 2:25 
QuestionHow to pass JavaScript variable to another page? Pin
samflex18-Feb-15 16:04
samflex18-Feb-15 16:04 

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.