By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,199 Members | 1,714 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,199 IT Pros & Developers. It's quick & easy.

Is this bad asp.net design for populating a form?

P: n/a
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.

Nov 19 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
ne***********@gmail.com wrote:
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.


What you propose, if I understood right, is fine. No need to stick it in
a grid if you only need a textbox....

--
Curt Christianson
site: http://www.darkfalz.com
blog: http://blog.darkfalz.com
Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.