Hi ramco1917,
I am working on it, I will get back to you soon.
Code
C#
protected void Page_Load(object sender, EventArgs e)
{
Order order = new Order();
order.OrderNo = 1;
order.OrderDate = DateTime.Now;
Root root = new Root();
root.Order = order;
root.OrderDetails = GetListOfStudents();
}
public List<OrderDetail> GetListOfStudents()
{
List<OrderDetail> orderDetails = new List<OrderDetail>();
orderDetails.Add(new OrderDetail
{
OrderNo = 1,
ItemCode = "012",
Amount = "5000"
});
orderDetails.Add(new OrderDetail
{
OrderNo = 1,
ItemCode = "013",
Amount = "4000"
});
return orderDetails;
}
public class Root
{
public Order Order { get; set; }
public List<OrderDetail> OrderDetails { get; set; }
}
public class Order
{
public int OrderNo { get; set; }
public DateTime OrderDate { get; set; }
}
public class OrderDetail
{
public int OrderNo { get; set; }
public string ItemCode { get; set; }
public string Amount { get; set; }
}
VB.Net
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
Dim order As Order = New Order()
order.OrderNo = 1
order.OrderDate = DateTime.Now
Dim root As Root = New Root()
root.Order = order
root.OrderDetails = GetListOfStudents()
End Sub
Public Function GetListOfStudents() As List(Of OrderDetail)
Dim orderDetails As List(Of OrderDetail) = New List(Of OrderDetail)()
orderDetails.Add(New OrderDetail With {
.OrderNo = 1,
.ItemCode = "012",
.Amount = "5000"
})
orderDetails.Add(New OrderDetail With {
.OrderNo = 1,
.ItemCode = "013",
.Amount = "4000"
})
Return orderDetails
End Function
Public Class Root
Public Property Order As Order
Public Property OrderDetails As List(Of OrderDetail)
End Class
Public Class Order
Public Property OrderNo As Integer
Public Property OrderDate As DateTime
End Class
Public Class OrderDetail
Public Property OrderNo As Integer
Public Property ItemCode As String
Public Property Amount As String
End Class
Screenshot