Classes, Models,
Classes, Models, Controllers, Views, References, Scripts,
//Creation of form tag Begins @using (Html.BeginForm("user_content","Main",FormMethod.Post, new { enctype = "multipart/form-data", id = "user_content_form" })) { } //Creation of form tag Ends $("#user_content_submit").click(function() { //Creation of FormData Object Begins var uc = new FormData($("#user_content_form")[0]); //Creation of FormData Object Begins alert("Hello Happy Guy, Mr. Dubai. How is Life?"); $.ajax({ type: 'POST', url: "/Main/user_content", data: uc, // contentType: 'application/json; charset=utf-8', //processData: true, contentType: false, processData: false, dataType: "json", success: function(response) { alert(response.message); $(".err-message").html(response.message); $(".err-message").css({ color: 'red' }).show('slow'); //Fade message out in 5 seconds setTimeout('$(".err-message").hide("slow")', 5000); //var newDiv = $('div').css({ position: 'absolute', left: '100px', top: '100px' }).text(response.message).appendTo($('.err-message')); //newDiv.fadeOut(5000); return false; } }); });
//Ways to connect to SQL server living_beautifullyEntities DB_Conn = new living_beautifullyEntities(); // 1. public SqlConnection conn_db = new SqlConnection("data source=DESKTOP-UAOGCQB; initial catalog=living_beautifully; integrated security=True;MultipleActiveResultSets=True;"); // 2. //public string conn_str_web_config = ConfigurationManager.ConnectionStrings["living_beautifullyDB"].ConnectionString; //3 public SqlConnection conn_web_config = new SqlConnection(ConfigurationManager.ConnectionStrings["living_beautifullyDB"].ConnectionString);//3
[HttpPost] public ActionResult user_content(user_content uc) { string mess; //validation part begins if (ModelState.IsValid) { mess = "is valid."; if (uc.selected_image != null) { HttpPostedFileBase file1 = uc.selected_image; string fname = process_typeFiles(file1); if ( fname == "File_Length_Error_Encountered") { return Json(new { success = "No", message = "Error encountered... MAX Image Length is 3MB.", JsonRequestBehavior.AllowGet }); } if (fname == "File_Extension_Error_Encountered") { return Json(new { success = "No", message = "Error encountered... Allowed Image Types are JPG/PNG.", JsonRequestBehavior.AllowGet }); } // below 1001 is user code. uc.content_image = "~/App_Images/" + fname; fname = Path.Combine(Server.MapPath("~/App_Images/"), fname); if (!System.IO.File.Exists(fname)) { uc.selected_image.SaveAs(fname); } } if (uc.selected_image_2 != null) { HttpPostedFileBase file1 = uc.selected_image_2; string fname = process_typeFiles(file1); if (fname == "File_Length_Error_Encountered") { return Json(new { success = "No", message = "Error encountered for Paragraph 1 Image... MAX Image Length is 3MB.", JsonRequestBehavior.AllowGet }); } if (fname == "File_Extension_Error_Encountered") { return Json(new { success = "No", message = "Error encountered for Paragraph 1 Image... Allowed Image Types are JPG/PNG.", JsonRequestBehavior.AllowGet }); } // below 1001 is user code. uc.paragraph_one_image = "~/App_Images/" + fname; fname = Path.Combine(Server.MapPath("~/App_Images/"), fname); if (!System.IO.File.Exists(fname)) { uc.selected_image_2.SaveAs(fname); } } if (uc.selected_image_3 != null) { HttpPostedFileBase file1 = uc.selected_image_3; string fname = process_typeFiles(file1); if (fname == "File_Length_Error_Encountered") { return Json(new { success = "No", message = "Error encountered for Paragraph 2 Image... MAX Image Length is 3MB.", JsonRequestBehavior.AllowGet }); } if (fname == "File_Extension_Error_Encountered") { return Json(new { success = "No", message = "Error encountered for Paragraph 2 Image... Allowed Image Types are JPG/PNG.", JsonRequestBehavior.AllowGet }); } // below 1001 is user code. uc.paragraph_two_image = "~/App_Images/" + fname; fname = Path.Combine(Server.MapPath("~/App_Images/"), fname); if (!System.IO.File.Exists(fname)) { uc.selected_image_3.SaveAs(fname); } } if (uc.selected_video != null) { string fileName = Path.GetFileNameWithoutExtension(uc.selected_video.FileName); string fileExt = Path.GetExtension(uc.selected_video.FileName); // below 1001 is user code. fileName = fileName + "1001" + fileExt; uc.content_video = "~/App_Videos/" + fileName; fileName = Path.Combine(Server.MapPath("~/App_Videos/"), fileName); if (!System.IO.File.Exists(fileName)) { uc.selected_video.SaveAs(fileName); } } } else { // if(string.IsNullOrEmpty(uc.content_type_code.ToString()) || string.IsNullOrEmpty(uc.sub_content_type_code.ToString()) || string.IsNullOrEmpty(uc.sub_sub_content_type_code.ToString())) if ((uc.content_type_code == 0) || (uc.sub_content_type_code == 0) || (uc.sub_sub_content_type_code == 0)) { return Json(new { success = "No", message = "Error encountered... Please make sure to enter all required fields.", JsonRequestBehavior.AllowGet }); } if ((uc.content_date.Year < DateTime.Now.Year) || (string.IsNullOrEmpty(uc.content_title)) || (string.IsNullOrEmpty(uc.content_summary)) || string.IsNullOrEmpty(uc.content_description)) { string err_mess = ""; if ((uc.content_date.Year < DateTime.Now.Year)) { err_mess = "Error encountered... Invalid Date Format."; } err_mess += "Error encountered... Please make sure to enter all required fields."; return Json(new { success = "No", message = err_mess, JsonRequestBehavior.AllowGet }); } } //validation part ends //List obj_uc = new List (); // obj_uc.Add(new user_content { user_content_code = 100 }); var conn = DB_Conn.Database.Connection; //conn_db.CreateCommand(); //var a = DB_Conn; conn.Open(); var var2 = conn.CreateCommand(); var2.CommandText = "SELECT NEXT VALUE FOR Sequence_user_content"; var sql_result = var2.ExecuteScalar(); //var conn = DB_Conn.Database.Connection; //conn.Open(); //var var2 = conn.CreateCommand(); //var2.CommandText = "INSERT INTO lb_user_content (user_code,user_content_code,content_type_code"; //var2.CommandText += "sub_content_type_code,sub_sub_content_type_code,content_title,content_date"; //var2.CommandText += "content_summary,content_description,content_image,content_video)"; //var2.CommandText += "VALUES (1001,1001,1001,1001,1001,'Title',05/16/2022,'Summary','Description',null,null)"; //var sql_result = var2.ExecuteScalar(); //var sql_result = 1018; // copy across all params lb_user_content obj_uc = new lb_user_content(); obj_uc.content_image = uc.content_image; obj_uc.paragraph_one_image = uc.paragraph_one_image; obj_uc.paragraph_two_image = uc.paragraph_two_image; obj_uc.content_video = uc.content_video; obj_uc.user_code = 1001; obj_uc.user_content_code = (int)sql_result; obj_uc.content_type_code = uc.content_type_code; obj_uc.sub_content_type_code = uc.sub_content_type_code; obj_uc.sub_sub_content_type_code = uc.sub_sub_content_type_code; obj_uc.content_title = uc.content_title; obj_uc.content_summary = uc.content_summary; obj_uc.content_description = uc.content_description; obj_uc.paragraph_one_title = uc.paragraph_one_title; obj_uc.paragraph_one_description = uc.paragraph_one_description; obj_uc.paragraph_two_title = uc.paragraph_two_title; obj_uc.paragraph_two_description = uc.paragraph_two_description; obj_uc.content_date = uc.content_date; //// list2.Add(new lb_user_content { content_image = list.First().user_content_code.ToString() }); DB_Conn.lb_user_content.Add(obj_uc); try { DB_Conn.SaveChanges(); } catch (Exception) { return Json(new { success = "Error", message = "error encountered...", JsonRequestBehavior.AllowGet }); throw; } return Json(new { success = "Yes", message = "Record Added Successfully...", JsonRequestBehavior.AllowGet }); //return RedirectToAction("user_content","Main", new { mess=mess}); }
//Record Deletion Logic begins if (con_code != 0) { var find_user_con = DB_Conn.lb_user_content.Find(con_code); try { var del_status = DB_Conn.lb_user_content.Remove(find_user_con); var commit_status = DB_Conn.SaveChanges(); ViewBag.err_message = "Record Deleted Successfully..."; } catch (Exception) { ViewBag.err_message = "error encountered..."; } } //Record Deletion Logic ends
public ActionResult user_content_maintenance(int con_code = 0,int cont_ID=0, int sub_cont_ID=0, int sub_sub_cont_ID=0, int page_no=1, int num_of_rec_to_disp =5,string func_type= null) { //Pagination Logic begins var var_page_no = page_no; if (page_no > 0) { var_page_no = page_no - 1; } //ViewBag.num_of_rec_to_disp = num_of_rec_to_disp; var records_to_skip = num_of_rec_to_disp * var_page_no; //Pagination Logic ends ViewBag.app_user_name = "Mr.Dubai "; string query1 = "SELECT t.content_type_name, a.sub_content_type_name,b.sub_sub_content_type_name,c.content_type_code, c.sub_content_type_code,c.sub_sub_content_type_code,"; query1 += " c.user_code,c.user_content_code,c.content_title,c.content_date,c.content_summary,c.content_description,"; query1 += " c.content_image,c.content_video,c.content_last_updated_date,c.content_row_updated_date,c.content_row_updated_by"; query1 += " FROM lb_user_content c,lb_sub_sub_content_type_master b, lb_sub_content_type_master a, lb_content_type_master t"; query1 += " WHERE c.content_type_code = b.content_type_code"; query1 += " AND c.sub_content_type_code = b.sub_content_type_code"; query1 += " AND c.sub_sub_content_type_code = b.sub_sub_content_type_code"; query1 += " AND b.sub_content_type_code = a.sub_content_type_code"; query1 += " AND b.content_type_code = a.content_type_code"; query1 += " AND a.content_type_code = t.content_type_code"; if (cont_ID != 0) { query1 += " AND c.content_type_code = " + cont_ID; }; if (sub_cont_ID != 0) { query1 += " AND c.sub_content_type_code = " + sub_cont_ID; }; if (sub_sub_cont_ID != 0) { query1 += " AND c.sub_sub_content_type_code = " + sub_sub_cont_ID; }; var query_for_tot_records = query1; query1 += " ORDER BY content_type_code,sub_content_type_code,sub_sub_content_type_code OFFSET " + records_to_skip; query1 += " ROWS FETCH NEXT " + num_of_rec_to_disp; query1 += " ROWS ONLY"; //Pagination Logic for total number of records begins var tot_num_rec = DB_Conn.Database.SqlQuery (query_for_tot_records).Count();// num_of_rec_to_disp ViewBag.tot_num_of_pages = Math.Ceiling((decimal)tot_num_rec/(decimal)num_of_rec_to_disp); ViewBag.activePageNum = page_no; //Pagination Logic for total number of records ends // List content_type_2 = DB_Conn.lb_user_content.SqlQuery(query1).ToList(); List user_content_1 = DB_Conn.Database.SqlQuery (query1).ToList(); var content_type = DB_Conn.lb_content_type_master.ToList(); //var ssub_content_type = DB_Conn.lb_content_type_master.ToList(); ViewBag.uc_text = cont_ID; ViewBag.vb_ucm_list = new SelectList(content_type, "content_type_code", "content_type_name", cont_ID); List vb_sub_list = new List () { new SelectListItem { Text = "Select Sub Content", Value = "0" } }; ViewBag.vb_ucm_sub_list = vb_sub_list; List vb_ssub_list = new List () { new SelectListItem { Text = "Select Sub Sub Content", Value = "0" } }; ViewBag.vb_ucm_sub_sub_list = vb_ssub_list; if (cont_ID != 0) { var sub_content_type = DB_Conn.lb_sub_content_type_master.Where(a => a.content_type_code == cont_ID).ToList(); ViewBag.vb_ucm_sub_list = new SelectList(sub_content_type, "sub_content_type_code", "sub_content_type_name", sub_cont_ID); } if (sub_cont_ID != 0) { var ssub_content_type = DB_Conn.lb_sub_sub_content_type_master.Where(a => a.content_type_code == cont_ID && a.sub_content_type_code == sub_cont_ID).ToList(); ViewBag.vb_ucm_sub_sub_list = new SelectList(ssub_content_type, "sub_sub_content_type_code", "sub_sub_content_type_name", sub_sub_cont_ID); } //ViewBag.err_message = mess; List disp_rec = new List () { new SelectListItem { Text = "5", Value="5"}, new SelectListItem { Text = "10", Value="10"}, new SelectListItem { Text = "50", Value="50"} }; if (num_of_rec_to_disp != 0) { ViewBag.vb_nortd = new SelectList(disp_rec, "Text", "Value", num_of_rec_to_disp); } return View(user_content_1); }
var t_user_content_t = (from h in DB_Conn.lb_user_content where (h.content_type_code == (decimal)cont_ID) &&(h.sub_content_type_code == (decimal)sub_cont_ID) && (h.sub_sub_content_type_code == (decimal)sub_sub_cont_ID) join b in DB_Conn.lb_sub_sub_content_type_master on new { h.content_type_code, h.sub_content_type_code, h.sub_sub_content_type_code } equals new { b.content_type_code, b.sub_content_type_code, b.sub_sub_content_type_code } join b1 in DB_Conn.lb_sub_content_type_master on new { h.content_type_code, h.sub_content_type_code } equals new { b1.content_type_code, b1.sub_content_type_code } join b2 in DB_Conn.lb_content_type_master on new { h.content_type_code } equals new { b2.content_type_code } select new user_content() { content_type_name = b2.content_type_name, sub_content_type_name = b1.sub_content_type_name, sub_sub_content_type_name = b.sub_sub_content_type_name, user_code = (int)h.user_code, user_content_code = (int)h.user_content_code, content_title = h.content_title, content_date = (DateTime)h.content_date, content_summary = h.content_summary, content_description = h.content_description, content_image = h.content_image }).ToList(); //return View(t_user_content_t);
public ActionResult user_content_maintenance(int con_code = 0,int cont_ID=0, int sub_cont_ID=0, int sub_sub_cont_ID=0, int page_no=1, int num_of_rec_to_disp =5,string func_type= null) { if (cont_ID != 0) { query1 += " AND c.content_type_code = " + cont_ID; }; if (sub_cont_ID != 0) { query1 += " AND c.sub_content_type_code = " + sub_cont_ID; }; if (sub_sub_cont_ID != 0) { query1 += " AND c.sub_sub_content_type_code = " + sub_sub_cont_ID; };
public ActionResult user_content_maintenance(int con_code = 0,int cont_ID=0, int sub_cont_ID=0, int sub_sub_cont_ID=0, int page_no=1, int num_of_rec_to_disp =5,string func_type= null) { var query_for_tot_records = query1; query1 += " ORDER BY content_type_code,sub_content_type_code,sub_sub_content_type_code OFFSET " + records_to_skip; query1 += " ROWS FETCH NEXT " + num_of_rec_to_disp; query1 += " ROWS ONLY";
public ActionResult user_content_maintenance(int con_code = 0,int cont_ID=0, int sub_cont_ID=0, int sub_sub_cont_ID=0, int page_no=1, int num_of_rec_to_disp =5,string func_type= null) { //Pagination Logic for total number of records begins var tot_num_rec = DB_Conn.Database.SqlQuery (query_for_tot_records).Count();// num_of_rec_to_disp ViewBag.tot_num_of_pages = Math.Ceiling((decimal)tot_num_rec/(decimal)num_of_rec_to_disp); ViewBag.activePageNum = page_no; //Pagination Logic for total number of records ends // List content_type_2 = DB_Conn.lb_user_content.SqlQuery(query1).ToList();
public ActionResult user_content_maintenance(int con_code = 0,int cont_ID=0, int sub_cont_ID=0, int sub_sub_cont_ID=0, int page_no=1, int num_of_rec_to_disp =5,string func_type= null) { List user_content_1 = DB_Conn.Database.SqlQuery (query1).ToList();
public ActionResult user_content_maintenance(int con_code = 0,int cont_ID=0, int sub_cont_ID=0, int sub_sub_cont_ID=0, int page_no=1, int num_of_rec_to_disp =5,string func_type= null) { var content_type = DB_Conn.lb_content_type_master.ToList(); //var ssub_content_type = DB_Conn.lb_content_type_master.ToList(); ViewBag.uc_text = cont_ID; ViewBag.vb_ucm_list = new SelectList(content_type, "content_type_code", "content_type_name", cont_ID); List vb_sub_list = new List () { new SelectListItem { Text = "Select Sub Content", Value = "0" } }; ViewBag.vb_ucm_sub_list = vb_sub_list; List vb_ssub_list = new List () { new SelectListItem { Text = "Select Sub Sub Content", Value = "0" } }; ViewBag.vb_ucm_sub_sub_list = vb_ssub_list; if (cont_ID != 0) { var sub_content_type = DB_Conn.lb_sub_content_type_master.Where(a => a.content_type_code == cont_ID).ToList(); ViewBag.vb_ucm_sub_list = new SelectList(sub_content_type, "sub_content_type_code", "sub_content_type_name", sub_cont_ID); } if (sub_cont_ID != 0) { var ssub_content_type = DB_Conn.lb_sub_sub_content_type_master.Where(a => a.content_type_code == cont_ID && a.sub_content_type_code == sub_cont_ID).ToList(); ViewBag.vb_ucm_sub_sub_list = new SelectList(ssub_content_type, "sub_sub_content_type_code", "sub_sub_content_type_name", sub_sub_cont_ID); } //ViewBag.err_message = mess; List disp_rec = new List () { new SelectListItem { Text = "5", Value="5"}, new SelectListItem { Text = "10", Value="10"}, new SelectListItem { Text = "50", Value="50"} }; if (num_of_rec_to_disp != 0) { ViewBag.vb_nortd = new SelectList(disp_rec, "Text", "Value", num_of_rec_to_disp); } return View(user_content_1); }
@{ var next_page = 0; var prev_page = 0; int start_page = 1; var pagination_set = 10; int add_displayset = 5; // start_offset below is a constant variable int start_offset = 5; var display_set = 0; //Previous Page Button Logic Begins if (ViewBag.activePageNum > 1) { prev_page = (int)ViewBag.activePageNum - 1; Previous } //Previous Page Button Logic Ends
//Previous Page Button Logic Begins if (ViewBag.activePageNum > 1) { prev_page = (int)ViewBag.activePageNum - 1; Previous } //Previous Page Button Logic Ends
//Start Page Logic and Display set Logic Begins if (ViewBag.activePageNum >= pagination_set) { //start Page variable definition Begins //start_offset is a CONST Variable //add_displayset is a CONST Variable start_page = ViewBag.activePageNum - start_offset; //start Page variable definition Ends // if ((ViewBag.activePageNum + start_offset) < ViewBag.tot_num_of_pages) if ((ViewBag.activePageNum + add_displayset) < ViewBag.tot_num_of_pages) { //add_displayset is a CONST Variable display_set = ViewBag.activePageNum + add_displayset; } else { display_set = (int)ViewBag.tot_num_of_pages; } } else { display_set = pagination_set; if (pagination_set > ViewBag.tot_num_of_pages) { display_set = (int)ViewBag.tot_num_of_pages; } } //Display set Logic Ends
//Page Buttons Logic Begins for (var i = start_page; i <= display_set; i++) { if (i == ViewBag.activePageNum) { //High Lighting Active Page Logic Begins @i next_page = i; //High Lighting Active Page Logic Begins } else { @i } } //Page Buttons Logic Ends
//Next Page Button Logic Begins if (next_page < ViewBag.tot_num_of_pages) { next_page += 1; Next } //Next Page Button Logic Ends }
//Page Buttons Logic Begins for (var i = start_page; i <= display_set; i++) { if (i == ViewBag.activePageNum) { //High Lighting Active Page Logic Begins (@i next_page = i; //High Lighting Active Page Logic Begins } else { (@i } } //Page Buttons Logic Ends $(".page_no").click(function () { var ct = $("#content_type").val(); var sct = $("#sub_content_type").val(); var ssct = $("#sub_sub_content_type").val(); var nortd = $("#no_of_pages").val(); var pg_no = $(this).attr("id"); // if (ct != 0 || sct != 0 || ssct != 0) { location.href = "/Main/user_content_maintenance?cont_ID=" + ct + "&sub_cont_ID=" + sct + "&sub_sub_cont_ID=" + ssct + "&page_no=" + pg_no + "&num_of_rec_to_disp=" + nortd; // } })
//Loop to display records begins @foreach (var item in Model) { < tr > < td colspan = "7" > < div class="card col-sm-12"> @Html.DisplayFor(modelItem => item.content_title, new { @class = "app_max-width" }) Content Category : @Html.DisplayFor(modelItem => item.content_type_name), @Html.DisplayFor(modelItem => item.sub_content_type_name), @Html.DisplayFor(modelItem => item.sub_sub_content_type_name) @Html.DisplayFor(modelItem => item.content_date) @Html.DisplayFor(modelItem => item.content_summary, new { @class = "" }) @Html.ActionLink("Edit", "Edit", new { id = item.user_content_code })       Display       Delete Last updated 3 mins ago } //Loop to display records Ends
Content Category : @Html.DisplayFor(modelItem => item.content_type_name), @Html.DisplayFor(modelItem => item.sub_content_type_name), @Html.DisplayFor(modelItem => item.sub_sub_content_type_name)
Last updated 3 mins ago
Display       //Javascript, Jquery code function func_display_or_delete(a,func_type) { var ct = $("#content_type").val(); var sct = $("#sub_content_type").val(); var ssct = $("#sub_sub_content_type").val(); var content_code = a; var pg_no = $("#hf_pageno").attr("value"); var nortd = $("#no_of_pages").val(); //alert("Func Display"+func_type); if(func_type == "func_display") { location.href = "/Main/Content_Page?con_code= " + content_code + " &cont_ID=" + ct + "&sub_cont_ID=" + sct + "&sub_sub_cont_ID=" + ssct + "&page_no=" + pg_no + "&num_of_rec_to_disp=" + nortd; } else if(func_type == "func_delete") { if(confirm("Do you want to delete Record?")) { location.href = "/Main/user_content_maintenance?con_code= " + content_code + " &cont_ID=" + ct + "&sub_cont_ID=" + sct + "&sub_sub_cont_ID=" + ssct + "&page_no=" + pg_no + "&num_of_rec_to_disp=" + nortd + "&func_type="+func_type; } } return false; }
Display       @Html.ActionLink("Back to Called Page", "user_content_maintenance", "Main", new { cont_ID = @ViewBag.cont_ID, sub_cont_ID = @ViewBag.sub_cont_ID, sub_sub_cont_ID = @ViewBag.sub_sub_cont_ID, page_no = @ViewBag.page_no, num_of_rec_to_disp = @ViewBag.vb_nortd_cp }, new { @class = "" })
//JQUERY Logic $("#user_content_search").click(function () { var ct = $("#content_type").val(); var sct = $("#sub_content_type").val(); var ssct = $("#sub_sub_content_type").val(); var nortd = $("#no_of_pages").val(); //alert("Hello Mr.Dubai"); // if (nortd != 0 ^ ct != 0 ^ sct != 0 ^ ssct != 0) { location.href = "/Main/user_content_maintenance?cont_ID=" + ct + "&sub_cont_ID=" + sct + "&sub_sub_cont_ID=" + ssct + "&page_no=1&num_of_rec_to_disp=" + nortd; // } })
public ActionResult user_content(string mess= "") { conn_db.Open(); var x = conn_db.CreateCommand(); x.CommandText = "SELECT * FROM lb_user_content"; SqlDataReader reader = x.ExecuteReader(); //OR// SqlCommand command = new SqlCommand("SELECT * FROM lb_user_content", conn_db); conn_web_config.Open(); SqlCommand command_1 = new SqlCommand("SELECT * FROM lb_content_type_master", conn_web_config); SqlDataReader reader_2 = command.ExecuteReader(); // Check if the DataReader has any row. if (reader.HasRows) { List ucli = new List () { new user_content { user_code = 1, user_content_code = 1001 }, new user_content { user_code = 2, user_content_code = 1002 }, }; user_content l = new user_content(); while (reader.Read()) { l.user_code = (decimal)reader[0]; l.user_content_code = (decimal)reader[1]; ucli.Add(l); ucli.Add(new user_content { user_code = (decimal)reader[0], user_content_code = (decimal)reader[1] }); } var ll = ucli.Count(); ucli.Add(new user_content { user_code = 3, user_content_code = 1003 }); ucli.Add(new user_content { user_code = 4, user_content_code = 1004 }); ucli.Add(new user_content { user_code = 5, user_content_code = 1005 }); { }; // Obtain a row from the query result. } if (reader_2.HasRows) { List uc111 = new List (); // Obtain a row from the query result. while (reader_2.Read()) { //var a = reader_2[1]; } } var content_type = DB_Conn.lb_content_type_master.ToList(); ViewBag.vb_ct_list = new SelectList(DB_Conn.lb_content_type_master.ToList(), "content_type_code", "content_type_name"); ViewBag.vb_ct_list_2 = new SelectList(content_type, "content_type_code", "content_type_name"); ViewBag.err_message = mess; ViewBag.app_user_code = "10011001"; ViewBag.app_user_name = "Mr.Dubai"; return View(); } @Html.DropDownList("no_of_pages", ViewBag.vb_nortd as SelectList, null, new { @class = "form-control", @style = "margin-left:20px;" }) @Html.DropDownList("no_of_pages", new List { new SelectListItem {Value="5", Text="5" }, new SelectListItem {Value="10", Text="10",Selected=true }, new SelectListItem {Value="50", Text="50" }}, new { @class = "form-control", @style = "margin-left:20px;" }) @Html.DropDownList("sub_content_type_code", (IEnumerable )ViewBag.vb_ucm_sub_list, "Select Sub Content Type", new { @class = "form-control", @id = "sub_content_type", @style = "margin-left:20px;" }) @Html.DropDownList("sub_content_type_code", new List { new SelectListItem { Text = "Select Sub Content", Value = "0" } }, new { @class = "form-control",@id = "sub_content_type" })
< ul class=""> @Html.ActionLink("Best Couple of the year Award.", "", "", null, new { @class = "" }) @Html.ActionLink("How my present colleagues are always the best.", "", "", null, new { @class = "" }) @Html.ActionLink("Login to Add Or Manage Content", "user_content_maintenance", "Main", null, new { @class = "" }) @Html.ActionLink("Search Information", "Manage_User_Content", "User", null, new { @class = "" }) | @Html.ActionLink("Search Deep", "Manage_User_Content", "User", null, new { @class = "" }) @Html.ActionLink("Luxury Shopping", "user_content_maintenance", "Main", null, new { @class = "" }) How this site is developed </ul>
Using onchange() Event, JQuery, Ajax to display DropDown List Values
JAVASCRIPT LIBRARIES lib 1 Lib 2 $(document).ready(function () { DATE PICKER CODE $(".datepicker").datepicker({ dateFormat: "mm-dd-yy", changemonth: true, changeyear: true }); }); HTML CODE TO DISPLAY From Date : @Html.Editor("From_Date", new { htmlAttributes = new { @class = "form-control datepicker", @type = "datetime", @readonly = "readonly", @style="z-index:2" } })
// object declaration var object_a = { ct:$("#content_type").val(), sct : $("#sub_content_type").val(), ssct: $("#sub_sub_content_type").val(), content_code : $(this).attr("name"), nortd : $("#no_of_pages").val(), pg_no : $("#hf_pageno").attr("value"), afunc : function(a,b){ alert("alert message " +(a+b));} }; var aa = new Object(); var aa111 = {}; aa.var1 = 1; aa.var2 = "abc"; aa.var3 = true; aa.var4 = "blah blah blah"; //object_a.afunc(1,2); aa.a1func = function(a,b,c) { return alert("alert message aaa"); }; //aa.a1func(); // Array object declaration var array_a = []; var array_abc = new Array();
if($(".err-message").html() != "") { $(".err-message").css({ color: 'red' }).show('slow'); //Fade message out in 5 seconds setTimeout('$(".err-message").hide("slow")', 5000); } var var1 = ''; if(var1 != "") { $(".err-message").html(''); $(".err-message").css({ color: 'red' }).show('slow'); //Fade message out in 5 seconds setTimeout('$(".err-message").hide("slow")', 5000); }
CONDITIONS FOR FILE UPLOADNG ============================ 1. blah blah blah 2. File Object in java script for front end validation 3. blah blah blah 4. File validation and saving at server side
© 2025 - Living Beautifully