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

Auto populate a field in VB ASP.NET

P: 9
Hi All,

FACTS:

> I've created a VB.NET 2005 form, with a SQL Server 2000 backend
> The form has about 30 fields that populate 30 columns in the SQL database
> The form has mostly text feilds, with standard info such as Customer, order Number, etc.
> Im trying to autopopulate one of the feilds on the form, called Reference Number.
> The SQL column on the backend auto increments fine
> The Reference Numbercolumn has identity specification 'Yes', Increment '1', etc.

WHAT IS WORKING:
> I fill out all the fields on the .aspx form, it populates the database fine
> The Reference number auto increments by 1, which is great


WHAT I WANT:
> Employee should be able to launch the form, and have the Reference Number field auto populate on the form.


QUESTION:
> Should the Reference Number part of the VB.NET web form be a label?

A text box accepts input from a user... but in the case of the Reference Number, the user should have it automatically populated open launching the page. sounds like a label to me.

Any help, code samples would be appreciated.

Thanks,

Best,
Paul
Jun 2 '09 #1
Share this Question
Share on Google+
2 Replies


tlhintoq
Expert 2.5K+
P: 3,525
A label would certainly work. Does it give you the visual appearance you want on the form? If everything else is a text box, maybe using a textbox would give you a more consistent appearance. Setting it to "read only" would keep people from changing the value. Changing the backcolor to something slightly off from the other textboxes gives the look that it is *meant* to not be changeable. You could also just set it to "enabled = false" to give it a dimmed appearance, not changeable, yet still readable.

So yes, a label will work. Do you like how that looks?
Jun 2 '09 #2

P: 9
Well, tlhintoq, your absolutely correct. A text box is better, set as read only - and changing the back color to show its not supposed to be changable. Your already getting me in the right direction!!

Now... how do I get this Text box populated with the auto increment from the database. It probably starts with some code in a Page_Load event... since a page load by the visitor is the event that fires the web form.

Thanks again!
Paul
Jun 2 '09 #3

Post your reply

Sign in to post your reply or Sign up for a free account.