MVC - DropDownList / TextBox

Associate
Joined
2 Sep 2007
Posts
1,975
Hi All

Ignore the crap look I'll work on that later. If a user types in an value into the textbox and clicks search I want to use that value to filter the dropdownlist which is bound to an dbset (entity framework). Any ideas? I assume I need to write some code in the ActionResult? Or am I wrong?

mvcdropdownlist.JPG


PHP:
  public ActionResult Search(string name)
        {
            //some operations goes here

            return View(); //return some view to the user
        }

PHP:
<body>
    <div>
        @using (Html.BeginForm("Search", "Home"))
        {
            @Html.TextBox("name")
            <input type="submit" value="Search" />
        }

        @using (Html.BeginForm())
        {
            @Html.LabelFor(x => x.SelectedApplicationId)
            @Html.DropDownList("SelectedApplicationId", new SelectList(Model.PeopleUnits, "ID", "UNIT_INSTANCE_CODE"))
        }
    </div>
</body>
 
Associate
OP
Joined
2 Sep 2007
Posts
1,975
Associate
OP
Joined
2 Sep 2007
Posts
1,975
So how did you get on?

I had a few problems so I had to revert to webforms as management wanted it implemented that day. :(

I'm a one man band here now (there was only 2 of us anyway) so it's hard to convince myself to use good practices such as dependency injection, IOCs, SOLID principles, etc when all management care about is that the systems I'm working on are ready asap. I've started to look for another jobs, I have another interview on Wednesday as I've realised that unless I get myself in a development team I'm not going to have the opportunity to learn off others or use good practices. Sorry, for the long reply but it gets to you.
 
Associate
OP
Joined
2 Sep 2007
Posts
1,975
It's a shame you didn't get it to work but there is no point trying to rush something.

As for all the dependency injection and other stuff there is no point cramming that in now if you are not familiar with the concepts. It will just complicate matters.

What I would suggest is get yourself a trial account on pluralsight and view a couple of the videos on MVC and start from there. It will explain the tech and the different way of thinking from webforms. As I said its a hard habit to break when you have been used to drag and drop controls.

I actually found using Telerik's kendo ui controls amazing for helping me get to grips with MVC a lot quicker. The MVC wrappers are amazing to help build quick code but gives you the flexibility to customize and extend.

Try to continue with the MVC as it will just click all at once and try to do some simple stuff first like a contact form and then expand from there.

Thanks for your comments. I do have a Pluralsight account and I have been going through videos by Scott Allen. I'm also reading this book which I've found to be really good - http://www.amazon.co.uk/Pro-NET-Framework-Professional-Apress/dp/1430242337. After I've finished with that then this book - http://www.amazon.co.uk/Dependency-...&sr=1-1-fkmr0&keywords=.net+depency+injection.

The Kendo controls look good but are quite expensive and they've already bought the DevExpress Universal for me.
 
Back
Top Bottom