Câu 1: Tạo một dự án asp. Net Mvc đặt tên theo cấu trúc: HoTen MaSV. Sử dụng file index html để xây dựng layout với tên là HoTen Layou



Download 19,53 Kb.
bet1/3
Sana23.07.2022
Hajmi19,53 Kb.
#840400
  1   2   3
Bog'liq
Document1 - Sao chép - Sao chép


Câu 1: Tạo một dự án ASP.Net MVC đặt tên theo cấu trúc: HoTen_MaSV. Sử dụng file index.html để xây dựng layout với tên là HoTen_Layou



  • Tạo dự án MVC

  • Mở View->Shared rồi copy file index.html->đổi tên thành DVD_Layout.cshtml

  • Copy thư mục css, images vào Content của MVC, thư mục font vào font, js vào Script

  • Tách Layout:

  • Chuottj phải vào Shared->Tạo các View DVD_header, DVD_Main, DVD_Footer (grat as a partial view)

  • Cắt toàn bộ phần , phần bên trong của div_content dán vào các View

  • Thay thế phần code của header, main, footer trong layout: @Html.Partial(“DVD_Hader”), @RenderBody,..

  • Chọn Controleer->Add controler->BaiThiContrller

  • BaiThiController->Tạo View cho index(sd layout của DVD_Layout)

  • Mở DVD_Layout.cshtml->Them ~/Content/ vào các đường dẫn css,js. Chạy thử, đã có css

  • Mở APP start-> BundleCofig

Thêm -> bundles.Add(new StyleBundle("~/Content/mycss").Include(
"~/Content/css/style.css",
"~/Content/css/slider.css"));
bundles.Add(new ScriptBundle("~/bundles/myscript").Include(

  • "~/Content/js/startstop-slider.js"));

  • Mở DVD_Layot, xóa hết 4 dòng địa chỉ

Dán vào chỗ vừa xóa: @Styles.Render("~/Content/css")
@Styles.Render("~/Content/mycss")
@Scripts.Render("~/bundles/jquery")
@Scripts.Render("~/bundles/myscript")
@Scripts.Render("~/bundles/bootstrap")
Chạy thử, ok.


Câu 2: Hiển thị các LoaiHang lên thanh điều hướng
2.1 (1 điểm): Sử dụng Entity framework, sinh các Model hỗ trợ kết nối cơ sở dữ liệu
2.2 (1 điểm): Load dữ liệu từ bảng LoaiHang và hiển thị lên trên thanh điều hướng, trong đó menu Home được thay thế bằng họ tên sinh viên ví dụ: “Nguyễn Văn An”



  • Tạo thư mục Entities trong thư mục Models

  • Mở Sql Server

  • THư mục Entities>Add item>Data>AOD.Net....> đặt tên DVD_Context>Add>Code firt from database>chọn toàn bộ bảng

  • Trong BaiThiController>thêm:

public ActionResult RenderNav()
{
DinhVanDong_Context db = new DinhVanDong_Context();
List listLoai = db.LoaiHang.ToList();
return PartialView("DinhVanDong_Header", listLoai);
}
Them using Dinhvan_Dong_191202209.Models.Entities;

  • Trong DVD_Header>thêm vào dòng đầu:@model IEnumerable

Sửa class menu
  1   2   3




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish