text box properties?!

tito_puente41

Member
Joined
Aug 18, 2005
Messages
9
Programming Experience
Beginner
hi all

i have a general question regarding text box properties... first a bit of an insight into my webform...

i have a web form with about 10 text boxes that should take in values such as name, address, etc... and dump that data into a new row in the db...

now i have two fields which i auto generate, ie. primary key ID field and date record was created...

the row gets created in the database, BUT the code won't accept values that are in the text boxes at the time of the button click while it creates values that are hardcoded (ID and date)... i don't understand...

is there some text box property that i'm not accounting for? i'm confused

thanks!

With data_set.Tables("DEALERS")
Dim new_row As DataRow
new_row = dataTable.NewRow

new_row("dealerID") = new_dealerID 'new ID created
new_row("dealer_num") = tb_dnum.Text
new_row("company") = tb_company.Text
new_row("address1") = tb_address1.Text
new_row("address2") = tb_address2.Text
new_row("city") = tb_city.Text
new_row("team") = tb_team.Text
new_row("dealer1") = tb_name1.Text
new_row("dealer2") = tb_name2.Text
new_row("dealer3") = tb_name3.Text
new_row("date_created") = DateTime.Now.Date.ToString()
'add date of account creation
.Rows.Add(new_row)
EndWith
 
when i dont use the .NewRow() of the dataset and i manually specify stuff this is what i do:
VB.NET:
			    Dim newRow As DataRow = dsCustomers1.Customers.NewRow
				newRow("Name") = txtName.Text
				newRow("Address") = txtAddress.Text
				newRow("City") = txtCity.Text
				newRow("State") = txtState.Text
				newRow("ZipCode") = txtZip.Text
			    dsCustomers1.Customers.Rows.Add(newRow)
			    daCustomers.Update(dsCustomers1, "Customers")

also (i dont know if this matters) but this is for a winform you were asking about webform
 
nput type="button" onclick="alert(document.forms[0].tb_company.value);" value="t

i don't think the problem is there, as new row is created in the database, and gets the primary key ID and the date... the problem is reading the textbox value at the event submit...

i tried testing by assigning the textbox value to a label, and it prints nothing, so the problem is definitely there... the row in the database is created with blank data...

when i use a <input type="button" onclick="alert(document.forms[0].tb_company.value);" value="test"

to test, it pops up the value of the text box...

i'm stumped
 
lol, never mind

i got it...

in page_load i had a function call to fill_form which fills the form with current record data...

i put it in if not page.ispostback and works!

DOH!
 
i would have suggested that except i dont know much about asp (i never even check the asp section here)

so everything i do know is windows forms

glad to know you've got it working
 
Back
Top