Archive for December 2015
My Model Popup
html
div class="row">
div id="popupChangeMarks" class="modal">
!-- dialog contents -->
div class="modal-body">
div class="col-md-4">
div style="margin-bottom: 5px" class="input-group">
span class="input-group-addon">Student ID
div id="popupChangeMarks" class="modal">
!-- dialog contents -->
div class="modal-body">
div class="col-md-4">
div style="margin-bottom: 5px" class="input-group">
span class="input-group-addon">Student ID
div>
div>
JQuery Popup
function LoadChangeMarksPopup() {
dialog = $("#popupChangeMarks").dialog({
autoOpen: true,
title: "Change Marks",
width: 800,
modal: true,
closeOnEscape: false,
open: function (event, ui) { $(".ui-dialog-titlebar-close", ui.dialog || ui).hide(); },
buttons: {
Save: function () {
//arrr['wt'] = $("#drpWithdrawalType").val();
UpdateMarks();
dialog.dialog("close");
LoadMarksByFetchStudentsToGrid();
},
Cancel: function () {
dialog.dialog("close");
$("#txtMarks").val("");
}
},
close: function () {
}
});
dialog.dialog("open");
}
--------------------------------------------
function LoadChangeMarksDetails()
{
var theGrid = $('#tblMarks'), rowID = theGrid.jqGrid('getGridParam', 'selrow'), value = theGrid.jqGrid('getCell', rowID, 'Student_M_ID');
$("#txtStudentID").val(value);
var theGrid = $('#tblMarks'), rowID = theGrid.jqGrid('getGridParam', 'selrow'), value = theGrid.jqGrid('getCell', rowID, 'Test_M_ID');
$("#txtTestID").val(value);
var theGrid = $('#tblMarks'), rowID = theGrid.jqGrid('getGridParam', 'selrow'), value = theGrid.jqGrid('getCell', rowID, 'Mark');
$("#txtMarks").val(value);
}
function initGrid() {
jQuery("#tblMarks").jqGrid({
datatype: "json",
colNames: [ 'Student ID', 'Name', 'Marks', 'Test ID'],
colModel: [
//{ name: 'School', index: 'School', align: "center", hidden: false, editable: false },
{ name: 'Student_M_ID', index: 'Student_M_ID', align: "center", hidden: false, editable: false },
{ name: 'Name', index: 'Name', align: "center", hidden: false, editable: false },
{ name: 'Mark', index: 'Mark', align: "center", hidden: false, editable: true },
{ name: 'Test_M_ID', index: 'Test_M_ID', align: "center", hidden: true, editable: true },
],
pgbuttons: true,
rowList: [],
pgtext: null,
pager: jQuery('#tblMarks-Pager'),
viewrecords: true,
sortorder: "asc",
autowidth: true,
height: "100%",
hiddengrid: false,
caption: "Student Marks",
cellEdit: false,
shrinkToFit: true,
cellsubmit: 'clientArray',
onSelectRow: function () {
// retrieveFmssFirstInspectionDetails();
//$("#ques").show();
// $("#tb").addClass("tab-pane");
},
ondblClickRow: function () {
// alert(value);
LoadChangeMarksPopup();
LoadChangeMarksDetails();
}
});
}
--------------------------------------------
function LoadChangeMarksDetails()
{
var theGrid = $('#tblMarks'), rowID = theGrid.jqGrid('getGridParam', 'selrow'), value = theGrid.jqGrid('getCell', rowID, 'Student_M_ID');
$("#txtStudentID").val(value);
var theGrid = $('#tblMarks'), rowID = theGrid.jqGrid('getGridParam', 'selrow'), value = theGrid.jqGrid('getCell', rowID, 'Test_M_ID');
$("#txtTestID").val(value);
var theGrid = $('#tblMarks'), rowID = theGrid.jqGrid('getGridParam', 'selrow'), value = theGrid.jqGrid('getCell', rowID, 'Mark');
$("#txtMarks").val(value);
}
function initGrid() {
jQuery("#tblMarks").jqGrid({
datatype: "json",
colNames: [ 'Student ID', 'Name', 'Marks', 'Test ID'],
colModel: [
//{ name: 'School', index: 'School', align: "center", hidden: false, editable: false },
{ name: 'Student_M_ID', index: 'Student_M_ID', align: "center", hidden: false, editable: false },
{ name: 'Name', index: 'Name', align: "center", hidden: false, editable: false },
{ name: 'Mark', index: 'Mark', align: "center", hidden: false, editable: true },
{ name: 'Test_M_ID', index: 'Test_M_ID', align: "center", hidden: true, editable: true },
],
pgbuttons: true,
rowList: [],
pgtext: null,
pager: jQuery('#tblMarks-Pager'),
viewrecords: true,
sortorder: "asc",
autowidth: true,
height: "100%",
hiddengrid: false,
caption: "Student Marks",
cellEdit: false,
shrinkToFit: true,
cellsubmit: 'clientArray',
onSelectRow: function () {
// retrieveFmssFirstInspectionDetails();
//$("#ques").show();
// $("#tb").addClass("tab-pane");
},
ondblClickRow: function () {
// alert(value);
LoadChangeMarksPopup();
LoadChangeMarksDetails();
}
});
}
JQ Grid Intializing Resources
Download Jquery.JqGrid using NuGet. Then add these Links
-----------------------------------------------------------------------
URL-
http://www.c-sharpcorner.com/UploadFile/97fc7a/integration-of-jqgrid-with-mvc4-application-part-1/
Index Page Html/Bootstrap
div class="container" style="z-index:0">
h1 id="hd-event-title">Event Details
hr>
form role="form">
div class="row">
div class="col-md-8">
div class="form-group">
label for="code">Title
input type="text" id="txt-event-title" class="form-control input-lg" required">
span id="spn-title-error" class="help-block">Please correct the error
div>
div>
h1 id="hd-event-title">Event Details
hr>
form role="form">
div class="row">
div class="col-md-8">
div class="form-group">
label for="code">Title
input type="text" id="txt-event-title" class="form-control input-lg" required">
span id="spn-title-error" class="help-block">Please correct the error
div>
div>
Posted by sinhalamp3
Bootstrap Import - Compulsory
BundleConfig.cs
bundles.Add(new ScriptBundle("~/Scripts/bootstrap").Include(
"~/Scripts/bootstrap.js")
);
bundles.Add(new ScriptBundle("~/Scripts/knockoutjs").Include(
"~/Scripts/knockout-{version}.js",
"~/Scripts/knockout.mapping.min.js",
"~/Scripts/ko.observableDictionary.js",
"~/Scripts/knockout-jqAutocomplete.js"
)
);
bundles.Add(new ScriptBundle("~/Scripts/jqueryui").Include(
"~/Content/jquery-ui-1.11.4/jquery-ui.js")
);
bundles.Add(new ScriptBundle("~/Scripts/jqueryval").Include(
"~/Scripts/jquery.validate*")
);
bundles.Add(new StyleBundle("~/Styles/bootstrap").Include(
"~/Content/bootstrap.css",
"~/Content/bootstrap-theme.css")
);
bundles.Add(new StyleBundle("~/Styles/font-awesome").Include(
"~/Content/font-awesome.css"
)
);
bundles.Add(new StyleBundle("~/Styles/jqueryui").Include(
"~/Content/jquery-ui-1.11.4/jquery-ui.css",
"~/Content/jquery-ui-1.11.4/jquery-ui.theme.css"
)
);
/////////////////////////////////////////////// FULL Bundle Config ...-----------------------
bundles.IgnoreList.Clear();
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/bootstrapjs").Include(
"~/Scripts/bootstrap.min.js"));
bundles.Add(new StyleBundle("~/Content/bootstrapcss").Include(
"~/Content/bootstrap.min.css",
"~/Content/bootstrap-responsive.min.css"));
//------------------------------------------------
bundles.Add(new ScriptBundle("~/bundles/jquery").Include(
"~/Scripts/jquery-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryui").Include(
"~/Scripts/jquery-ui-{version}.js"));
bundles.Add(new ScriptBundle("~/bundles/jqueryval").Include(
"~/Scripts/jquery.unobtrusive*",
"~/Scripts/jquery.validate*"));
// Use the development version of Modernizr to develop with and learn from. Then, when you're
// ready for production, use the build tool at http://modernizr.com to pick only the tests you need.
bundles.Add(new ScriptBundle("~/bundles/modernizr").Include(
"~/Scripts/modernizr-*"));
bundles.Add(new StyleBundle("~/Content/css").Include("~/Content/site.css"));
bundles.Add(new StyleBundle("~/Content/themes/base/css").Include(
"~/Content/themes/base/jquery.ui.core.css",
"~/Content/themes/base/jquery.ui.resizable.css",
"~/Content/themes/base/jquery.ui.selectable.css",
"~/Content/themes/base/jquery.ui.accordion.css",
"~/Content/themes/base/jquery.ui.autocomplete.css",
"~/Content/themes/base/jquery.ui.button.css",
"~/Content/themes/base/jquery.ui.dialog.css",
"~/Content/themes/base/jquery.ui.slider.css",
"~/Content/themes/base/jquery.ui.tabs.css",
"~/Content/themes/base/jquery.ui.datepicker.css",
"~/Content/themes/base/jquery.ui.progressbar.css",
"~/Content/themes/base/jquery.ui.theme.css"));
//-------------------------------------------------------------------------
bundles.Add(new ScriptBundle("~/Scripts/bootstrap").Include(
"~/Scripts/bootstrap.js")
);
bundles.Add(new ScriptBundle("~/Scripts/knockoutjs").Include(
"~/Scripts/knockout-{version}.js",
"~/Scripts/knockout.mapping.min.js",
"~/Scripts/ko.observableDictionary.js",
"~/Scripts/knockout-jqAutocomplete.js"
)
);
bundles.Add(new ScriptBundle("~/Scripts/jqueryui").Include(
"~/Content/jquery-ui-1.11.4/jquery-ui.js")
);
bundles.Add(new ScriptBundle("~/Scripts/jqueryval").Include(
"~/Scripts/jquery.validate*")
);
bundles.Add(new StyleBundle("~/Styles/bootstrap").Include(
"~/Content/bootstrap.css",
"~/Content/bootstrap-theme.css")
);
bundles.Add(new StyleBundle("~/Styles/font-awesome").Include(
"~/Content/font-awesome.css"
)
);
bundles.Add(new StyleBundle("~/Styles/jqueryui").Include(
"~/Content/jquery-ui-1.11.4/jquery-ui.css",
"~/Content/jquery-ui-1.11.4/jquery-ui.theme.css"
)
);
------------------------------------------- Layout Page Import JQuery and Others -----------
@* @System.Web.Optimization.Scripts.Render("~/Scripts/jquery-1.9.1")*@
@System.Web.Optimization.Scripts.Render("~/Scripts/jqueryui")
@* @System.Web.Optimization.Scripts.Render("~/Scripts/jquery")*@
@* @System.Web.Optimization.Scripts.Render("~/Scripts/bootstrap")*@
@System.Web.Optimization.Styles.Render("~/Styles/jqueryui")
@System.Web.Optimization.Styles.Render("~/Styles/bootstrap")
@System.Web.Optimization.Styles.Render("~/Styles/font-awesome")
@System.Web.Optimization.Scripts.Render("~/Scripts/knockoutjs")