Skip to main content

Posts

Showing posts with the label MVC

Detect browser language and other information in ASP.NET

If you just want to detect browser language you can use this CultureInfo ci; if (userLanguages.Count() > 0) { try { ci = new CultureInfo(userLanguages[0]); } catch (CultureNotFoundException) { ci = CultureInfo.InvariantCulture; } } else { ci = CultureInfo.InvariantCulture; } if you want to get more details then use this string browser = HttpContext.Request.Browser.Browser; string version = HttpContext.Request.Browser.Version; string type = HttpContext.Request.Browser.Type; string platform = HttpContext.Request.Browser.Platform; string userAgent = HttpContext.Request.UserAgent; string[] userLang = HttpContext.Request.UserLanguages; var userLanguages = Request.UserLanguages; For MVC use this in your Home controller action.

kendoDropDownList json datasource

if you want to load your kendoDropDownList  from json we service you can follow this script $('#Branchs').kendoDropDownList({ // optionLabel: "Select branch...", dataTextField: "text", dataValueField: "value", change: function () { e.model.BranchRef = this.text(); }, dataSource: { transport: { read: function (e) { $.ajax({ url: 'http://localhost/Notifier/Branches/GetDropDown/token', type: 'GET', dataType: 'json', success: function (data) { { e.success(data); ...

ASP.NET MVC razor SAP Crystal report

Crete a new project: Add a aspx Master Page Create a new folder Reports and 2 sub folder crystal & crystalviewer Now add a web form page in crystalviewer  folder. Add the master page namespace in your web form page. MasterPageFile ="~/Views/Shared/ReportSite.Master" Replace your web form by this code < asp : Content ID ="Content1" ContentPlaceHolderID ="ContentPlaceHolder1" runat ="server">      </ asp : Content > Now go to design mode of your web form drag & drop the crystal report viewer in your web form. After that your page will be look look like this. Replace the code: < CR : CrystalReportViewer ID ="EmployeeList" runat ="server"   HasCrystalLogo ="False"     AutoDataBind ="True"   Height ="50px"   EnableParameterPrompt ="false" EnableDatabaseLogonPrompt ...

Posting JSON data via jQuery to ASP .NET MVC 4 controller action not working

The grid data if I want to save data in json call then if the json data cross the limit of JsonDeserializer then it will not work on controller action.  function SaveMenuPrivilege() { var postUrl; var paramValue; var gridData = $("#MenuPrivilegeKendoGrid").data("kendoGrid").dataSource.data(); // set model data for (var i = 0; i < gridData.length; i++) { gridData[i].NewRoleId = $("#RoleId").val(); } postUrl = '@Url.Content("~/Admin/MenuPrivilege/SaveMenuPrivilege")'; paramValue = JSON.stringify({ MenuPrivilegeList: gridData }); // you can also set model data using',' $.ajax({ url: postUrl, type: 'POST', dataType: 'json', data: paramValue, contentType: 'application/json; charset=utf-8', success: function (result) { console.log(result); }, ...