I am looking for the right way to implement "remember me" check box, and until now i didn't find good & simple solution for doing that so I have added together pieces of code.

Can you please direct me for the steps for doing that right? i thought that in 2015 it will be straight forward..

Those are the steps I did (I think it's a little bit clumsy)

  1. The user try to login- if he entered the right username & password, i check to see if a cookie["rememberMe"] is exist,
  2. if not- i am creating a new cookie and name it "rememberMe"

                    var token = Guid.NewGuid();
                    HttpCookie rememberMe = new HttpCookie("rememberMe");
                    rememberMe["username"] = username;
                    BL.SetCookieToken(username, token);
                    rememberMe["token"] = token.ToString();
    

    SetCookieToken is writing the new cookie token to db- in the users table there is a column "cookieToken".

  3. When the user re-open the browser, in the pageload event the app goes to db and check for the specific user if the tokens matches

            protected void Page_Load(object sender, EventArgs e)
            {
                if (Request.Cookies["rememberMe"] != null)
                {
                   var username = Request.Cookies["rememberMe"]["username"];
                   var token = Request.Cookies["rememberMe"]["token"];
                   Guid cookieToken = BL.GetTokenByUserName(username);
    
                   if (cookieToken.ToString() == token)
                   {
                     Response.Redirect("~/Pages/home.aspx");
                   }
               }
           }
    

Am i doing that the right way?

I am trying to take the print of Canvas in A4 size by setting height and width to 29.7cm and 21cm respectively.

I am getting proper output on Windows 7 devices. But for Windows 10 devices, the print output is not same as Windows 7 devices.

The real problem is height and width is not maintained for Windows 10 devices.

Please Help and Suggest Me !!

Please find below code:

Xaml:

<Window x:Class="TestSolution.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        VerticalContentAlignment="Stretch"
        HorizontalContentAlignment="Stretch"
        Height="29.7cm"
        Width="21cm"
        ResizeMode="NoResize">
    <Grid x:Name="grdTest" 
           VerticalAlignment="Stretch"
                HorizontalAlignment="Stretch"
           Height="29.7cm"
                Width="21cm">
         <Canvas x:Name="cnvTest"
                VerticalAlignment="Stretch"
                Height="29.7cm"
                Width="21cm"
                HorizontalAlignment="Stretch">
        </Canvas>               
    </Grid>         
</window>

Code Behind

private void btn_Click(object sender, RoutedEventArgs e)
        {
            PrintDialog prnt = new PrintDialog();

            if (prnt.ShowDialog() == true)
            {
                prnt.PrintVisual(cnvTest, "Printing Canvas");
            }
            this.Close();
        }

I am trying to create a (in my opinion) quite simple setup, but I can't figure out why I keep getting this error when I run Update-Database:

Introducing FOREIGN KEY constraint 'FK_dbo.Breweries_dbo.Pages_PageId' on table 'Breweries' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints.

I am trying to setup this structure:

Brewery > Page > IdentityUser

This is my classes:

public class Brewery
{
    [Key]
    [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
    public Guid BreweryId { get; set; }

    [Required]
    public string Name { get; set; }

    [Required]
    [ForeignKey("Page")]
    public Guid PageId { get; set; }

    public virtual Page Page { get; set; }

    public virtual ICollection<Image> Images { get; set; }
}

public class Page
{
    [Key]
    [DatabaseGeneratedAttribute(DatabaseGeneratedOption.Identity)]
    public Guid PageId { get; set;}
    [Required]
    public string Title { get; set; }

    public string Content { get; set; }
    [Required]
    [ForeignKey("CreatorUser")]
    public string CreatorUserId { get; set; }

    public virtual IdentityUser CreatorUser { get; set; }
}

I have seen a lot of other Stack Overflow posts and it seems like I should be setting something up in the OnModelCreating, but I can't get it right. I would like to avoid having a ICollection<Brewery> Breweries property on the Page, since I want many different entities to reference to the Page entity and it is irrelevant for a Page who is referencing to it.

I am new to Entity Framework and Code First so I might have approached this wrong without knowing. I would appreciate any help to setup the relationships correct.

Since I can't access a session variable in the View, I wonder if I need do add something more to the view to get it to work?

Inside my View:

@Session[ComputerNumber].ToString()

Controller:

Session["ComputerNumber"] = game.RandomNumber();

The error message:

Compiler Error Message: CS0103: The name 'ComputerNumber' does not exist in the current context

I am looking for a control to display events in timeline.

Like the one in this site

https://www.nics.gov.au/Timeline

I'm working on Asp.net MVC 5 project . I have below code and it works fine without error , my problem is : in page load showed all of records , I want to show a specific record . How can I do it ?

controller :

public ActionResult GoodDetails(int id)
    {
        HomeVM vm = new HomeVM();
        var goodDetails = db.GoodDetails.Where(p => p.FKSubGoods == id).ToList();
        vm.GoodDetails = goodDetails;
        return View(vm);

    }
public PartialViewResult GoodDetailsAjax(int id)
    {
        HomeVM vm = new HomeVM();
        var GoodDetailsAjax = db.GoodDetails.Where(p => p.DetailsGoodID == id).ToList();
        vm.GoodDetails = GoodDetailsAjax;
        return PartialView("_GoodDetailsAjax", vm);
    }

_GoodDetailsAjax.cshtml :

 @model NP1.ViewModels.HomeVM
 <div>
    @foreach (var item in Model.GoodDetails)
    {
    <img class="img-responsive" src="@Url.Content(item.DetailsImage1.ToString())">
    <img class="img-responsive" src="@Url.Content(item.DetailsImage2.ToString())">
    <img class="img-responsive" src="@Url.Content(item.DetailsImage3.ToString())">
    <img class="img-responsive" src="@Url.Content(item.DetailsImage3.ToString())">

}
</div>

I added @{Html.RenderPartial("_GoodDetailsAjax", Model);} to Target div to show a record on page load , but it shows all records and I don't know how write a specific record. I wrote some codes instead of Model but they didn't work . Thanks for any help .

<div>
@foreach (var item1 in Model.GoodDetails)
{
    @Ajax.ActionLink("LinkText", "GoodDetailsAjax", new { id = @item1.DetailsGoodID }, new AjaxOptions()
{
HttpMethod = "GET",
UpdateTargetId = "DivAjax",
InsertionMode = InsertionMode.Replace
}
)
      <input type="image" src="@Url.Content(item1.DetailsSmallImage1.ToString())">


}
</div>

 <div id="DivAjax">
     @{Html.RenderPartial("_GoodDetailsAjax", Model);}
 </div>

I have a file conversion utility which extracts a page in a file and saves in the fixed 6 digit file name like:

000001.jpg  -  first page of file
000002.jpg  -  second page of file
...
000010.jpg  -  tenth page of file
000011.jpg  -  eleventh page of file
000100.jpg  -  hundredth page of file
000101.jpg  -  and so on...
...
001000.jpg
001001.jpg
...
...
999999.jpg  -  upto the maximum 999999th page. (6 digits max)

etc.

I mean the preceding 0 digits gets eliminated when file number reaches extra digit. The file name will always be 6 digits from 000001.jpg to 999999.jpg

Now, in my code I am trying to read all files. I am using a for loop with a counter from 1 to 999999 to read the file names. But when I use File.Read("00000" + iCount + ".jpg"); it gives error when for loop counter is 10 because then it becomes 7 digits: 0000010.jpg and the file name becomes invalid. And like it becomes 8 digits when the counter is 100.

How do I generate file names in my for loop in the valid manner?

I am using MVC. I want to test subdomains on localhost with IIS. What I have done to create a subdomain is:

  1. I added a line to windows host file

    127.0.0.1       localhost
    127.0.0.1       abc.localhost
    ::1             localhost
    
  2. I edited applicationhost.config as:

     <bindings>
           <binding protocol="http" bindingInformation="*:59322:localhost" />
           <binding protocol="http" bindingInformation="*:59322:abc.localhost" />
     </bindings>
  1. I added following class to RouteConfig.cs :

    public class SubdomainRoute : RouteBase { public override RouteData GetRouteData(HttpContextBase httpContext) { var host = httpContext.Request.Url.Host; var index = host.IndexOf("."); string[] segments = httpContext.Request.Url.PathAndQuery.Split('/'); if (index < 0) return null; var subdomain = host.Substring(0, index); string controller = (segments.Length > 0) ? segments[0] : "Home"; string action = (segments.Length > 1) ? segments[1] : "Index"; var routeData = new RouteData(this, new MvcRouteHandler()); routeData.Values.Add("controller", controller); routeData.Values.Add("action", action); routeData.Values.Add("subdomain", subdomain); return routeData; } public override VirtualPathData GetVirtualPath(RequestContext requestContext, RouteValueDictionary values) { //Implement your formating Url formating here return null; } }

  2. Now To get subdomain name in controller:

    public string subdomainName
            {
                get
                {
                    string s = Request.Url.Host;
                    var index = s.IndexOf(".");
                    if (index < 0)
                    {
                        return null;
                    }
                    var sub = s.Split('.')[0];
                    if (sub == "www" || sub == "localhsot")
                    {
                        return null;
                    }
                    return sub;
                }
            }
    
  3. My Index method is:

    public string Index() { if (subdomainName == null) { return "No subdomain"; } return subdomainName; }

Now the url http://localhost:59322/ is working fine. But the url http://abc.localhost:59322/ gives the error

Bad Request - Invalid Hostname

HTTP Error 400. The request hostname is invalid.

what I am doing wrong. Why the subdomain is not working?

In this post, Understanding ASP.NET View State, the author says this:

It is a common misconception among developers that view state is somehow responsible for having TextBoxes, CheckBoxes, DropDownLists, and other Web controls remember their values across postback. This is not the case, as the values are identified via posted back form field values, and assigned in the LoadPostData() method for those controls that implement IPostBackDataHandler.

So, when I disable viewstate for textbox, it still persists its text value across postback, which is correct based on the description above.

However, when I disable ViewState for a ListBox, which also implements IPostBackDataHandler, it does not persists its state in postbacks. For example, the code provided below is supposed to cause duplicate data, but it does not if I disable the ViewState for this specific control.

Am I missing something here?

protected void Page_Load(object sender, EventArgs e)
{
        lbox.Items.Add("1");
        lbox.Items.Add("2");
        lbox.Items.Add("3");
    }
}

I have created i project, i get the value from the user in a specific format, then i convert it to DateTime object.

this is my code

        DateTime dateGreg1 = DateTime.ParseExact(startDate, "dd/MM/yyyy", CultureInfo.InvariantCulture);

this code is working fine with my computer, but when i copied the project to another computer, this error comes:

String was not recognized as a valid DateTime.

my question, why the program is running in the original computer, but when i copied it, it did not run :(

is there any configuration that i should do ?

I am using Visual Studio 2012

thank you

This might be a very simple question, but i've been trying for about 4 hours now and can't seem to figure it out.

I'm trying to learn some Javascript, so I build a little word game with the use of Jquery and after that I made the same game using Angular. Both the games work the same and to remove duplicate code I made an API with ASP.NET. The API has three GETs;

One for checking if a word is valid(takes a string/returns a Boolean).

[HttpGet]
[ActionName("Word")]
public Boolean checkWord(String word){..}

One to create a board for the game (returns an array of strings).

[HttpGet]
[ActionName("Score")]
public int updateScore(String word){..}

One to score a word(takes a string/returns an int)

[HttpGet]
[ActionName("Board")]
public string[] createBoard()

So now I'm trying to connect these two games to the API. The API is just running locally on my pc at the moment. Now in the Jquery game I made a function like this;

function getBoard() {
  $.getJSON(uri)
      .done(function (data) {
        $.each(data, function (key, item) {
          board.push(item);
        });
    });
    alert("Data: " + board);
}

This was used in the 'Getting started with ASP.NET web API' and if I do a request like this the API gets the request, yet the data object is always empty. Every variation on the above code I tried just keeps failing.

If I type the URI in my browser, it does give me the right response and doesn't fail.

It seems like a very simple problem but my knowledge of Javascript/Jquery/Angular is very limited at the moment and I can't seem te figure it out on my own.

I hope you guys can help me out here.

When I click on a link from a list of names, I want it to be removed from the list. I have search a lot about LINQ and it seems that RemoveAll should do the job, but I get this annoying message when I call the Action in the Controller:

The model item passed into the dictionary is of type 'System.Int32', but this dictionary requires a model item of type 'System.Collections.Generic.IEnumerable`1[System.String]'.

If I interpret this correctly I'm trying to pass a INT to the Action method!?

This is the list of strings in the Model:

public static List<string> listOfNames = new List<string>();

This is the html actionlink(I have also tested to use a query string):

@foreach (var item in Model)
{
    <tr>
        <td>
            @Html.ActionLink(item, "DeleteNameList", new { Id = item })
        </td>
    </tr>
}

This is the action method in the Controller:

public ActionResult DeleteNamelist(string nameToDelete)
{
    return View("NameInput", NameModel.listOfNames.RemoveAll(x => x == nameToDelete));
}

I'm trying to solve the best architecture for a survey system and which design patterns to use. We have the following type of questions:

  • One correct answer is possible - dropdown or radio buttons
  • Multiple choice - checkboxes
  • Yes/No - radio buttons with Yes/No
  • Short Text
  • Long Text
  • Number - e.g. When was ...?
  • Correct order - e.g. order the answers in the correct order

I'd like to have Drawing API and Validating API So I came up with "Bridge Pattern" which is mostly used for drawing. But there's something I'm missing.

What I tried is this:

public abstract class Question : IDrawable, IValidatable
{
    protected readonly IQuestionFormatter questionFormatter;
    protected readonly IQuestionValidator validator;

    public string Title { get; set; }

    public Question(IQuestionFormatter questionFormatter, IQuestionValidator validator)
    {
        this.questionFormatter = questionFormatter;
        this.validator = validator;
    }

    public abstract void Draw();

    public abstract bool Validate();

}

    public interface IQuestionValidator
{
    bool ValidateQuestion(IEnumerable<string> userInput, 
                          IEnumerable<string> questionAnswers);
}

    public interface IQuestionFormatter
{
    string FormatQuestion(string title, IEnumerable<string> options);
}

Then I create RefinedAbstractions for MultipleChoiceQuestion, OnePossibleAnswerQuestion and ShortAnswer. The problem is that MultipleChoiceQuestion can have many correct Answers and many UserInput.

public class MultipleChoiceQuestion : Question
{
    public List<string> Options { get; set; } = new List<string>();
    public List<string> Answers { get; set; } = new List<string>();
    public List<string> UserInput { get; set; } = new List<string>();

    public MultipleChoiceQuestion(IQuestionFormatter questionFormatter, IQuestionValidator validator) : base(questionFormatter, validator)
    {
    }

    public override void Draw()
    {
        var result = questionFormatter.FormatQuestion(Title, Options);
        Console.WriteLine(result);
    }

    public override bool Validate()
    {
        return validator.ValidateQuestion(UserInput, Answers);
    }
}

OnePossibleAnswerQuestion has many Answers but One UserInput.

 public class OnePossibleAnswerQuestion : Question
{
    public string UserInput { get; set; }
    public string Answer { get; set; }
    public List<string> Options { get; set; } = new List<string>();

    public OnePossibleAnswerQuestion(IQuestionFormatter questionFormatter, IQuestionValidator validator) : base(questionFormatter, validator)
    {
    }

    public override void Draw()
    {
        var result = questionFormatter.FormatQuestion(Title, Options);
        Console.WriteLine(result);
    }

    public override bool Validate()
    {
        return validator.ValidateQuestion(new List<string> { UserInput }, new List<string> { Answer });
    }
}

ShortAnswer has one Answer and one UserInput. I'm not sure how to create the design. public class ShortAnswer : Question { public string UserInput { get; set; } public string Answer { get; set; }

    public ShortAnswer(IQuestionFormatter questionFormatter, IQuestionValidator validator) : base(questionFormatter, validator)
    {
    }

    public override void Draw()
    {
        var result = questionFormatter.FormatQuestion(Title, new List<string> { "" });
        Console.WriteLine(result);
    }

    public override bool Validate()
    {
        return validator.ValidateQuestion(new List<string> { UserInput }, new List<string> { Answer });
    }
}

But when I got to the OnePossibleAnswerQuestion or ShortAnswer the .Validate() .Draw() started smelling. Probably I have defined wrong interfaces?

My goal is to have something like this:

    List<Question> questions = new List<Question>();

    // ... add some questions using Builder or Factory Design Pattern

    // draw the questions
    foreach (var question in questions)
    {
        question.Draw();
    }

    // validate the questions
    foreach (var question in questions)
    {
        question.Validate();
    }

Could you please help me what I miss and how to composite the classes? Am I using the wrong design pattern?

Thanks in advance!

I'm working on a web application project, i just got stuck in validation testing. here is the requirement is, when i enter value in text box like E-mail or Mobile Number, then page must display an error

Please select E-mail Type or Mobile Type.

if user doesn't enter any value in text box, it must not report error.

I want to get the search results from the link:http://dblp.uni-trier.de/ based on the request am giving from .aspx page over multiple search engines(Google & Bing) at a time.

Here is the code to extract contents from site (over Google):

WebClient cl = new WebClient();
cl.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
cl.DownloadString("http://dblp.uni-trier.de/search?q=" + Session["Org_Qry"].ToString());

I've got a serious problem. I'm using the following pattern for properties. But even a simple ModeIdx++ isn't working (ModeIdx keeps the old value). The cookie keksGS is initialized properly. I'm using Visual Studio 2013 for Debugging @ localhost.

  public int ModeIdx
    {
        get{  return Convert.ToInt32(Page.Request.Cookies["keksGS"].Values["modIdx"]);  }
        set{ Page.Response.Cookies["keksGS"].Values["modIdx"] = value.ToString(); }
    }

My first thouhgt about this problem was, that the browser (Firefox 42.0) has too less time updating the cookie so Page.Request keeps the value. So I added Page.Response.Flush(); but nothing changed.

I'm recently thinking I'm doing something fundamental wrong, but I can't figure out what/how I should do this instead.

I have a function that is being called on window resize

$(window).resize(setVideoElements);

That function sets the height for a class of videoThumbnail containers

var setVideoElements = function () { setElementsHeight('.videothumbnail'); };

function setElementsHeight(selector) {

    console.log('setting Max element height');

    // Get an array of all element heights
    var elementHeights = $(selector).map(function () {
        return $(this).height();
    }).get();

    // Math.max takes a variable number of arguments
    // `apply` is equivalent to passing each height as an argument
    var maxHeight = Math.max.apply(null, elementHeights);

    // Set each height to the max height
    $(selector).height(maxHeight);
}

The function works fine except for the fact that its firing too quickly

<div class="thumbnail videothumbnail">
  <a href="@Url.Action("Video", new { ID = Video.ID })">
    <img class="videoThumbnailImg" src="@Video.ThumbnailUrl" alt="">
  </a>
  <div class="caption">
     <h3>@Video.Name</h3>
     @foreach (var tag in Video.TagsToVideos)
     {
        <span><a href="#">@tag.Tag.Name</a></span>
     }
  <p>@Video.Description</p>
</div>

The issues is that the function is firing before the images are resize. I need to fire the resize function after all of the images have already been resized.

Do anyone know how to fire this function once after all of the images have Resized?

I want to access scanner from my asp.net web application, I wanted to know the best web technologies (silverlight, flash) through which I can access the scanner.

I am having troubles finding this functionality, partially because I dont know what to search for. My english sometimes ends up being a huge roadblock for me and I have had no luck in finding what I am looking for.

Basically what I want to achieve is as I type names I will get a dropdown list below my textbox which will display top 10 names that already exist so that I can click on one of them and it will auto populate the text box.

I am trying to accomplish this in ASP.NET MVC5 C#.

I am basically looking for any guides, references, or even what this functionality is called so that I can do proper research on it.

Here is an image illustrating what I am talking about: http://s9.postimg.org/8cxd0t0ov/stack.png

I'm trying to do a database query from my Controller, then return the required data to my View so I can see a list of Product names with the corresponding COUNT within a webgrid.

To be honest I still don't understand asp.net-mvc fully but hopefully someone could help out or at least lead me in the right direction thanks!

Controller Code:

    public ActionResult Index()
    {

        string allProdQuery = "SELECT Products.Id, Products.Name, Products.EditDate "
            + "COUNT(Steps.Id) AS StepCount "
            + "FROM Products LEFT OUTER JOIN Steps "
            + "ON Products.Id = Steps.ProductId "
            + "GROUP BY Products.Id, Products.Name, Products.EditDate";

        IEnumerable<InstSetsDBEntities> pData = db.Database.SqlQuery<InstSetsDBEntities>(allProdQuery);

        return View(pData.ToList());
    }

View Code:

@{
    ViewBag.Title = "Index";

    var grid = new WebGrid(source: ViewBag.pData, rowsPerPage: 20);
 }

<h2>Index</h2>

@Html.ActionLink("Create New", "Create")
    <h3>All Products | <a href="~/rcAdmin/New">Create Product</a> </h3>
    <div id="grid">
        @grid.GetHtml(
                        tableStyle: "rcGrid",
                        headerStyle: "head",
                        alternatingRowStyle: "alt",
                        footerStyle: "pgr",
                        columns: grid.Columns(
                            grid.Column("Name", "Product Name", style: "rcGB"),
                            grid.Column("StepCount", "Steps", style: "rcGB"),
                            grid.Column("EditDate", "Last Edited", style: "rcGB"),
                            grid.Column(format:@<text><a href="EditProduct.cshtml?id=@item.Id" title="Edit Product"><img src="images/edit_page.gif" class="rcGC" alt="Edit"/>Manage</a></text>)

                    )
                )
</div>

Database Structure:

(DB) - (TABLES) - (ROWS)

InstSetsDB

  • Products
    • Id
    • Name
    • EditDate
  • Steps
    • Id
    • ProductId

I am new to MVC and I am trying to make a Checkbox List for my data. I have 3 tables:

CREATE TABLE [dbo].[Competency] (
    [Id]           INT          IDENTITY (1, 1) NOT NULL,
    [Icon]         VARCHAR (5)  NOT NULL,
    [Description]  VARCHAR (50),
    PRIMARY KEY CLUSTERED ([Id] ASC)
);
CREATE TABLE [dbo].[User] (
    [Id]           INT          IDENTITY (1, 1) NOT NULL,
    [Name]         VARCHAR (50)  NOT NULL,
    PRIMARY KEY CLUSTERED ([Id] ASC)
);
CREATE TABLE [dbo].[UserCompetency] (
    [UserId]       INT NOT NULL,
    [CompetencyId] INT NOT NULL,
    PRIMARY KEY CLUSTERED ([UserId] ASC, [CompetencyId] ASC),
    CONSTRAINT [FK_UserCompetency_ToCompetency] FOREIGN KEY ([CompetencyId]) REFERENCES [dbo].[Competency] ([Id]),
    CONSTRAINT [FK_UserCompetency_ToUser] FOREIGN KEY ([UserId]) REFERENCES [dbo].[User] ([Id])
);

So I have a list of Competencies and Users, and each User could have zero or more of these Competencies.

EntityFramework created my User class as follows:

public partial class User
{
    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
    public User()
    {
        this.Competencies = new HashSet<Competency>();
    }

    public int Id { get; set; }
    public string Name { get; set; }

    [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
    public virtual ICollection<Competency> Competencies { get; set; }
}

In MVC and Razor, I am trying to make a CheckBoxList so that the user can pick and choose which competencies go with each user. The User Create.cshtml contains this code:

@foreach(Competency comp in Competencies)
{
    @Html.CheckBoxFor(model => model.Competencies.Contains(comp))
    @Html.DisplayFor(model => comp.Icon, new { Title = comp.Description })
}

I am getting the error:

Templates can be used only with field access, property access, single-dimension array index, or single-parameter custom indexer expressions.

on the line with the CheckBoxFor.

I understand that using the CheckboxFor should be linked to a Boolean field in the model, which I do not have since this is getting data from a lookup table.

I would like to avoid changing the model created by the EntityFramework because then whenever it gets updated, I would have to remember to re-make the change.

Does anyone know how I can get the CheckBoxFor to work when referencing a lookup table that does not involve modifying my model?