C# Snippet - Eg Net Solution

Here in this sites web and software developer can get some essential information.

MY Favorite .Net Question For Interview

This are not tidy. Just for rough. In Sha Allah will make it tiddy soon. 1.  DateTime2 Date range 0001-01-01 through 9999-12-31  vs Date...

Users Countries


Tuesday, October 9, 2018

C# Snippet


1. Formatting Date-time:  string.Format("{0:dd/MM/yy}", DateTime.Today)
2. Storing List Data in ViewBag and retrieve the List Data in View Or Getting List Data From ViewBag :

3. If you want to pass multiple different list in a View from ASP .Net MVC Controller Action How can you pass it?
Answer: 
In Action:  ViewBag.MyClassList = new List<MyClass>() ;
 List<MyClass> MyClassList = ViewBag.MyClassList as List<MyClass>;

Returning JSON Data From Server To Client :: 
  1.  var data = obj_dal.LoadAllProductCode(TKTCode, "1", allMenu.User.USER_ID.ToString());    
  2.             var MaxJson = Json(new { ListProductCode = data});
  3.             MaxJson.MaxJsonLength = 999999999;
  4.             return MaxJson;
Or
  1. var MaxJson =   Json(new { ListOrderBooking = obj_dal.LoadOrderBookingDL(OrderNo, allMenu.User.EMPLOYEE_ID.ToString()) });
  2. MaxJson.MaxJsonLength = 999999999;
  3. return MaxJson;

No comments:

Add Choice