N
needin4mation
I have a database with values. I retrieve the data from that database.
I want to display that data from the database on the webpage.
Is it incorrect to take that data and assign it manually like:
(assuming I have textboxes named like this)
txtLastName.Text = MyDataReader.Item("MyDatabaseColumn");
or, am I supposed to do it in a grid or some other control like this:
<ItemTemplate>
<asp:TextBox id="lbl_employer" runat="server" Width="200" text='<%#
DataBinder.Eval(Container.DataItem, "employer") %>'>
</asp:TextBox>
</ItemTemplate>
The former seems just like I did in Classic ASP, so it makes me think
it is "wrong." These textboxes are populated and then the user can
update, etc. from the form. This form doubles as dataentry for new
records also. I was just reusing everything. Does it matter?
Improper design?
Thank you for advice.
I want to display that data from the database on the webpage.
Is it incorrect to take that data and assign it manually like:
(assuming I have textboxes named like this)
txtLastName.Text = MyDataReader.Item("MyDatabaseColumn");
or, am I supposed to do it in a grid or some other control like this:
<ItemTemplate>
<asp:TextBox id="lbl_employer" runat="server" Width="200" text='<%#
DataBinder.Eval(Container.DataItem, "employer") %>'>
</asp:TextBox>
</ItemTemplate>
The former seems just like I did in Classic ASP, so it makes me think
it is "wrong." These textboxes are populated and then the user can
update, etc. from the form. This form doubles as dataentry for new
records also. I was just reusing everything. Does it matter?
Improper design?
Thank you for advice.