I am new to razor. I need to load list items to the dropdownlist
using razor and data form the my custom database using entity framework (linq).
For example
I have Suburb table in my db. Now I created the dll using entity framework.
I want use this dll within umbraco ( using razor) and load the Suburb to the
drop down list.
can someone help me on this. Or direct me into one sample. Or some links.
Razor is just C#, so you can add a reference (@using) to your namespace and then access your classes and methods. You might find a static class will make things simpler.
e.g. here is a simple static class in some other dll
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace UmbOktoberFest2014.MyThings
{
public static class MyStuff
{
public static string EasyDateFormat()
{
return DateTime.Now.ToString("F");
}
}
}
razor + entity framework
Hi every one.
I am new to razor. I need to load list items to the dropdownlist using razor and data form the my custom database using entity framework (linq). For example
I have Suburb table in my db. Now I created the dll using entity framework. I want use this dll within umbraco ( using razor) and load the Suburb to the drop down list.
can someone help me on this. Or direct me into one sample. Or some links.
thanks in advance
regards
Shashi
Hi Shashi,.
About razor - http://www.dotnetbull.com/2013/08/bind-dropdownlist-in-dotnet-mvc-razor.html
It isn't great idea to bind dropdown list to data in the razor.
Thanks, Alex
Hi Shashi,
Razor is just C#, so you can add a reference (@using) to your namespace and then access your classes and methods. You might find a static class will make things simpler.
e.g. here is a simple static class in some other dll
Now in my Razor view
At the top:
Somewhere in the code:
Jeavon
is working on a reply...