Asi bych vygeneroval vlastní tabulku (asp:Table), kde se do každé buňky vygeneruje odkaz, ve kterém se předá vybraný řádek a sloupec. Příklad: ASPX:
<asp:Literal ID="LiteralValue" runat="server" />
<asp:Table ID="Table1" runat="server" border="1">
</asp:Table>
CS:
protected void Page_Load(object sender, EventArgs e)
{
SaveValue();
FillTable();
}
private void SaveValue()
{
if (Request["Time"]!=null)
{
LiteralValue.Text = string.Format("Date: {0}, Time: {1}", Request["Date"], Request["Time"]);
}
}
private void FillTable()
{
var times = new string[] { "8", "9", "10" };
var dates = new string[] { "19.10.2010", "20.10.2010", "21.10.2010" };
// headers
var rowHeader = new TableRow();
rowHeader.Cells.Add(new TableCell()
{
Text = "Datum"
});
foreach (var time in times)
{
rowHeader.Cells.Add(new TableCell()
{
Text = time
});
}
Table1.Rows.Add(rowHeader);
// cells
foreach (var date in dates)
{
var row = new TableRow();
row.Cells.Add(new TableCell()
{
Text = date
});
foreach (var time in times)
{
row.Cells.Add(new TableCell()
{
Text = string.Format(@"<a href=""Scheduler.aspx?Time={0}&Date={1}"">vybrat</a>", time, date)
});
}
Table1.Rows.Add(row);
}
}
|