I have question, that maybe someone here wouldn\'t mind to help me with. I have lets say 3 datatables, each one of them has the following columns:
size, quantity, amo
If your'e using Web Forms then Grid View can work very nicely for this
The code looks a little like this.
aspx page.
You can either input the data manually or use the source method in the code side
public class Room
{
public string Name
public double Size {get; set;}
public int Quantity {get; set;}
public double Amount {get; set;}
public int Duration {get; set;}
}
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)//this is so you can keep any data you want for the list
{
List rooms=new List();
//then use the rooms.Add() to add the rooms you need.
GridView1.DataSource=rooms
GridView1.Databind()
}
}
Personally I like MVC4 the client side code ends up much lighter than Web Forms. It is similar to the above example with using a class but you use a view and Controller instead.
The View would look like this.
@model YourProject.Model.IEnumerable
@Html.LabelFor(model => model.Name)
@Html.LabelFor(model => model.Size)
@Html.LabelFor(model => model.Quantity)
@Html.LabelFor(model => model.Amount)
@Html.LabelFor(model => model.Duration)
foreach(item in model)
{
@model.Name
@model.Size
@model.Quantity
@model.Amount
@model.Duration
}
The controller might look something like this.
public ActionResult Index()
{
List rooms=new List();
//again add the items you need
return View(rooms);
}
Hope this helps :)