Posts

Showing posts from May, 2014

An error occurred while updating the entries. See the inner exception for details.

Kendo UI web Grid how to set default null values to a grid when adding new row

Image
In your Kendo UI web grid model binding just use '?' allow null in your model class property. Which property you want to use in your grid as nullable.
Model:
[Key] public System.Guid? CompanyId { get; set; } public System.String CompanyName { get; set; } public System.String CompanyAddress { get; set; }
Kendo Grid :

.Columns(columns => { columns.Bound(p => p.CompanyId).Hidden(); columns.Bound(p => p.CompanyName).Width(200); columns.Bound(p => p.CompanyAddress).Width(300); columns.Command(command => { command.Edit(); command.Destroy();}).Width(172); })
UI



how to pass the multiple values in session ASP.NET

Set Value in session
// Set value in one UI in session string empIdList = GetSelectedIDofGrid(); var paramObjects = new Dictionary<string, object> { {"paramEmployeeXmlstr", empIdList}, {"paramFactoryId", ddlFactoryName.SelectedValue} }; Session["paramPayroll_RPT014_Staff"] = paramObjects;
Get value from session

// Get Value in another UI From session private string _paramEmployeeXmlstr = String.Empty; private string _paramFactoryId = String.Empty; var paramObjects = Session["paramPayroll_RPT014_Staff"] as Dictionary<string, object>; if (paramObjects != null) { _paramEmployeeXmlstr = (string)paramObjects["paramEmployeeXmlstr"]; _paramFactoryId = (string)paramObjects["paramFactoryId"]; }

sql row value wise count

Image
Query:

SELECT COUNT(CASE WHEN DayStatusID = 1 THEN 1 END) AS A, COUNT(CASE WHEN DayStatusID = 7 THEN 1 END) AS B, COUNT(CASE WHEN DayStatusID = 3 THEN 1 END) AS C from Payroll_tblYearMonthDayEntry
Result: