public class CertNotValidException : Exception { public CertNotValidException() : base() { } public CertNotValidException(string message) : base(message) { } public CertNotValidException(string format, params object[] args) : base(string.Format(format, args)) { } public CertNotValidException(string message, Exception innerException) : base(message, innerException) { } public CertNotValidException(string format, Exception innerException, params object[] args) : base(string.Format(format, args), innerException) { } }
c# Create custom exception
Jquery UI Dialog
$("#dialog").dialog({ autoOpen: false, height: 500, width: 960 }); $("#dialog").dialog("open");
<div id="dialog" title="Dialog title"></div>
ASP NET MVC JQuery table with ajax refresh
var oProtocolTable = $('#ProtocolTable').DataTable({ "bPaginate": false, "ordering": false, "bFilter": false, "bInfo": false, "bProcessing": true, "bLengthChange": false, "ajax": "/Home/ProtocolAjaxHandler", "language": { "url": "Content/Russian.txt" }, "fnServerParams": function (aoData) { aoData.push({ "name": "GroupID", "value": GroupID }); aoData.push({ "name": "OrgInn", "value": orgINN }); aoData.push({ "name": "check_id", "value": check_id }); } }); $('#OrganisationRisk tbody').on('click', 'tr', function () { check_id = oOrganisationRisk.cell(this, 0).data(); oProtocolTable.ajax.reload(); });
/// <summary> /// Class that encapsulates most common parameters sent by DataTables plugin /// </summary> public class JQueryDataTableParamModel { /// <summary> /// Request sequence number sent by DataTable, same value must be returned in response /// </summary> public string sEcho{ get; set; } /// <summary> /// Text used for filtering /// </summary> public string sSearch{ get; set; } /// <summary> /// Number of records that should be shown in table /// </summary> public int iDisplayLength{ get; set; } /// <summary> /// First record that should be shown(used for paging) /// </summary> public int iDisplayStart{ get; set; } /// <summary> /// Number of columns in table /// </summary> public int iColumns{ get; set; } /// <summary> /// Number of columns that are used in sorting /// </summary> public int iSortingCols{ get; set; } /// <summary> /// Comma separated list of column names /// </summary> public string sColumns{ get; set; } }
public ActionResult ProtocolAjaxHandler(JQueryDataTableParamModel param, int? GroupID, string OrgInn, int? check_id) { var riski = RiskiRepository.Show_Protocol(OrgInn ?? "", GroupID ?? 0, check_id ?? 0); if (riski == null) return Json(new { data = new List<string>() }, JsonRequestBehavior.AllowGet); return Json(new { aaData = from emp in riski select new[] { emp.description, emp.date_check.ToShortDateString() } }, JsonRequestBehavior.AllowGet); }
ASP NET MVC JQUERY send ajax request and get results
var ooData = { GroupID: GroupID, OrgInn: orgINN, check_id: oOrganisationRisk.cell(this, 0).data() }; var jqxhr = $.post("/Home/ProtocolAjaxHandler", ooData, function (data) { var ss = ""; $.each(data, function (i) { ss = ss + "<tr><td>" + this.description + "</td><td>" + this.date_check + "</td></tr>"; }); $("#ProtocolTable").html(ss);
[HttpPost] public ActionResult ProtocolAjaxHandler(ProtocolPost _param) { var riski = RiskiRepository.Show_Protocol(_param.OrgInn ?? "", _param.GroupID ?? 0, _param.check_id ?? 0); return Json(riski); }
public class ProtocolPost { public string OrgInn {get;set;} public int? GroupID { get; set; } public int? check_id { get; set; } }
ASP NET JQuery Table with refreshing content
http://www.codeproject.com/Articles/177335/Refreshing-content-of-the-table-using-AJAX-in-ASP
https://evolpin.wordpress.com/2011/04/12/asp-net-mvc-partialview-with-ajax/
simple example of jquery ajax mvc
https://evolpin.wordpress.com/2011/04/12/asp-net-mvc-partialview-with-ajax/
simple example of jquery ajax mvc
c# timer without timer
public void OnStart() { _stop.Reset(); _registeredWait = ThreadPool.RegisterWaitForSingleObject(_stop, new WaitOrTimerCallback(PeriodicProcess), null, 5000, false); } public void OnStop() { _stop.Set(); } private void PeriodicProcess(object state, bool timeout) { if (timeout) { // Periodic processing here } else // Stop any more events coming along _registeredWait.Unregister(null); } private ManualResetEvent _stop = new ManualResetEvent(false); private RegisteredWaitHandle _registeredWait;
//It's the method for periodically calling some methothds without using Timers. I think it is more elegant solution for this.
//Waiting process works in separate thread pool. Calling method works in main thread. Be carefull with that.
Subscribe to:
Posts (Atom)