如何将前端数据库中的数据显示为标签 [英] How to Display data in front end from database as a labels

查看:358
本文介绍了如何将前端数据库中的数据显示为标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用mvc,我需要将数据库中的数据显示为前端的标签,请您帮助我显示
我可以在应用程序本身中显示数据,看代码

这是我的模型(属性)

I am working with mvc i need to display data from database as a labels in front end could you plz help me to display
I can show the the data in application in itself,look the code

this is my model(properties)

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace MvcBugTracker.Models
{
    public class ViewBugModels
    {
        public static List<ViewBugModels> ViewBugsList { get; set; }

        public string Title { get; set; }
        public string Description { get; set; }

        public static List<ViewBugModels> ViewProjects { get; set; }
        public Int16 ProjectId { get; set; }
        public string projectName { get; set; }
        public string status { get; set; }

        public static List<ViewBugModels> ViewCategory { get; set; }
        public Int16 CategoryID { get; set; }
        public string Category { get; set; }

        public string Version { get; set; }
        public string BuildNumber { get; set; }

        public static List<ViewBugModels> ViewReleasePhase { get; set; }
        public int ReleasePhaseID { get; set; }
        public string ReleasePhase { get; set; }

        public static List<ViewBugModels> ViewPrirority { get; set; }
        public string Prirority { get; set; }
        public Int16 PriorityID { get; set; }

        public static List<ViewBugModels> ViewSeverity { get; set; }
        public int SeverityID { get; set; }
        public string Severity { get; set; }

        public static List<ViewBugModels> ViewType { get; set; }
        public int TypeID { get; set; }
        public string Type { get; set; }


        public static List<ViewBugModels> UpdateBugList { get; set; }
        public int BugHistoryID { get; set; }
        public int BugID { get; set; }

        public int FixedByID { get; set; }
        public int AssignedTo { get; set; }
        public string Resolution { get; set; }
        public string FromStatus { get; set; }
        public string ToStatus { get; set; }
    }
}



这是我的控制器



this is my controller

namespace MvcBugTracker.Controllers
{
    public class ViewBugssController : Controller
    {

        // GET: /ViewBugss/

        public ActionResult ViewBugDeta()
        {
            MvcBugTracker.Models.ViewBugModels Details = new MvcBugTracker.Models.ViewBugModels();
            //var EditBugss = ViewBugDetails();

            Details.Title = "Title";
            Details.Description = "Description";
            Details.Version = "new version";

            return View(Details);
        }


这是我的aspx页面


and this my aspx page

<html>
<head runat="server">
    <title>ViewBugDeta</title>
</head>
<body>
   <fieldset style=" border: 1px solid #CCCCCC; margin: 1px 0 0 10px; padding: 1em; width: 400px;">
    <legend >ViewBugDeta</legend>
    <div class="lable_main">
    <div class="title">
      <div class="title_text" >
            Title<%=Model.Title %>
            </div>
        <div class="title_text" >
           Description<%=Model.Description %>
        </div>
        </div>
        </div>
        <div class="project_main">
       <div class="title_text" >
          Version<%=Model.Version %>
        </div>

    </div>

</fieldset>
</body>
</html>



它正在将详细信息显示为标签,但我需要从数据库中显示它
所以我需要从数据库中获取标题和描述,版本,并需要显示为标签plz可以帮助我从数据库中将数据显示为标签


提前谢谢您



it is displaying the the details as labels bu i need to display it from database
so i need to get Title,and description ,Version from database and need to show as labels plz help me to show the data as labels from database


Thankyou in advance

推荐答案

看看这个,它应该对您有帮助.
使用Code First和Entity Framework 4.1构建MVC 3应用 [
Take a look at this, It should help you.
Building an MVC 3 App with Code First and Entity Framework 4.1[^]


这篇关于如何将前端数据库中的数据显示为标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆