B
Ben
Hi,
I come from classic asp and i need some advice for this application.
It's about a computer reservation system in a school. I want a page where a
student can see his own made reservations, the number and the date of each
reservation, and where he can check a checkbox beside each reservations to
cancel it (or them).
Those data are in a database. I use aspnet 2.0.
What i would like is a table with four cells (one for each field + one for a
chekbox).
I tried different things, like creating a table in test.aspx file and then
adding rows in test.aspx.vb file, like this:
(in test.aspx file)
<asp:Table id="Table1" runat="server"/>
....
(in test.aspx.vb)
sql = "select ... "
....
dtreader = comd.ExecuteReader
....
For j = 0 To numberofrec - 1
dtreader.Read()
r = New TableRow()
For i = 0 To numberoffield - 1
c = New TableCell()
f = dtreader.GetValue(i)
c.Text() = f
r.Cells.Add(c)
Next i
table1.Rows.Add(r)
Next j
This works, but it's only showing the reservations.
My idea was now to create each row a checkbox with as ID the reservation
number, and then in test.aspx and in JavaScript, posting a form to a file
that delete the checked records.
But if i do (in test.aspx.vb):
ch = new checkbox
page.controls.add(ch)
i get :"The Controls collection cannot be modified because the control
contains code blocks (i.e. <% ... %>). "
And how to put the checkbox into the fourth cell?
So is there a better approach for this? What should be in test.aspx and what
in test.aspx.vb?
I did it with classic asp (with javascript). An solution would be to put the
whole asp file in test.aspx and drop test.aspx.vb, but then why is aspnet
good for?
Thanks for any advices.
Ben
I come from classic asp and i need some advice for this application.
It's about a computer reservation system in a school. I want a page where a
student can see his own made reservations, the number and the date of each
reservation, and where he can check a checkbox beside each reservations to
cancel it (or them).
Those data are in a database. I use aspnet 2.0.
What i would like is a table with four cells (one for each field + one for a
chekbox).
I tried different things, like creating a table in test.aspx file and then
adding rows in test.aspx.vb file, like this:
(in test.aspx file)
<asp:Table id="Table1" runat="server"/>
....
(in test.aspx.vb)
sql = "select ... "
....
dtreader = comd.ExecuteReader
....
For j = 0 To numberofrec - 1
dtreader.Read()
r = New TableRow()
For i = 0 To numberoffield - 1
c = New TableCell()
f = dtreader.GetValue(i)
c.Text() = f
r.Cells.Add(c)
Next i
table1.Rows.Add(r)
Next j
This works, but it's only showing the reservations.
My idea was now to create each row a checkbox with as ID the reservation
number, and then in test.aspx and in JavaScript, posting a form to a file
that delete the checked records.
But if i do (in test.aspx.vb):
ch = new checkbox
page.controls.add(ch)
i get :"The Controls collection cannot be modified because the control
contains code blocks (i.e. <% ... %>). "
And how to put the checkbox into the fourth cell?
So is there a better approach for this? What should be in test.aspx and what
in test.aspx.vb?
I did it with classic asp (with javascript). An solution would be to put the
whole asp file in test.aspx and drop test.aspx.vb, but then why is aspnet
good for?
Thanks for any advices.
Ben