Click here to Skip to main content
16,009,847 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
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)

XML
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

C#
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);
        }

and this my aspx page
HTML
<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>


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
Posted
Updated 24-Jul-12 1:54am
v2
Comments
StianSandberg 24-Jul-12 8:13am    
What do you mean "show as labels"
<label><%=Model.Description %></label> ??
This is a label..
[no name] 24-Jul-12 9:51am    
Okay so what is it that you are having trouble with? Nowhere in your code are you connecting to or retieving any information from any sort of a database....

1 solution

Take a look at this, It should help you.
Building an MVC 3 App with Code First and Entity Framework 4.1[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900