English 中文(简体)
MVC3 - Get info from DB & populatione inpuout.cshtml
原标题:MVC3 - Get info from DB & populate in layout.cshtml

我设立了一个应用程序管理员,由所有其他主计长继承。 我试图利用该主计长从银行获得用户的全名,该行被排到GisBag &在布局中捕获。

I aslo在全球产生了一个会议变量。 缩略语 我的问题是,会议变数在应用主计长c中是无效的。 然而,本届会议的变量在所有儿童主计长中都有适当的人员。 这里有我的应用程序管理员。

public abstract class ApplicationController : Controller
{
    private SkadPROEntities db = new SkadPROEntities();

    public SkadPROEntities SkadProDB
    {
        get { return db; }                
    }


    public ApplicationController()
    {
        //string[] currentUserString = User.Identity.Name.Split( \ );
        //string myCurrentUser = currentUserString[1];
        //string myCurrentUser = Session["currentUser"].ToString();
        var empQuery = from employee in db.PRO_LSN_EMPLOYEE_OBJ
                       //where employee.LSN_Security_Nbr == Session["currentUser"].ToString()
                       where employee.LSN_Security_Nbr == "bhopkins"
                       select employee;
        string firstName = "";
        foreach (var myEmployee in empQuery)
        {
            firstName = myEmployee.LSN_cf_First_Name;
        }
        ViewBag.FirstName = firstName;
        ViewBag.EmpName = "Bill Test";
    } 
}

为什么会议在申请主计长cs中失去效力,但在所有儿童主计长中居住?

最佳回答

你们可以在建筑商中掌握进入会场的变量。 或许,你在你的孩子,而不是他们的建筑者的行动范围内,再次试图进入本届会议。

。 协会会议没有举行。 MVC 主计长

问题回答

暂无回答




相关问题
How to update shared view adminheader.cshtml from a model

I ve added a drop down into my shared adminheader.cshtl view and it needs to be dynamically updated from data from a table. So when I use another view like routeplan.cshtml I load the view from ...

ASP.NET MVC Razor view engine

After reading Scott Guthrie s blog entry about the new Razor view engine for ASP.NET MVC and reading this question comparing the available view engines. Razor seems to address most of the problems ...

Client Id for Property (ASP.Net MVC)

I m trying to do a label for a TextBox in my View and I d like to know, how can I take a Id that will be render in client to generate scripts... for example: <label for="<%=x.Name.ClientId%>"...

Get Current Area Name in View or Controller

How do you get the current area name in the view or controller? Is there anything like ViewContext.RouteData.Values["controller"] for areas?

MVC which submit button has been pressed

I have two buttons on my MVC form: <input name="submit" type="submit" id="submit" value="Save" /> <input name="process" type="submit" id="process" value="Process" /> From my Controller ...

热门标签