<asp:textbox> again!

andycharger

Centurion
Joined
Apr 2, 2003
Messages
152
Guys,
Im really struggling with this one. I get this error on my page

'TextBox' cannot have children of type 'DataBoundLiteralControl'.

Basically, I need to use an asp:textbox on my screen and supply it with a value from my datalist. It seems to me that I cannot pass values from my datalist to an asp:textbox for some reason. This is what the message says.

Im doing this because I need an asp:textbox to supply with a date on my screen from my pop up calendar. It is using client side javascript and will not work when I try and use a standard <input> box.

Any ideas?
 
New problem

OK, I have managed to pass the value into my ASP:textbox within my datalist.

My ASP:TEXBOX id = txtDateRec
It is INSIDE my datalist.

However, when I press my submit button, I do some checking....

Visual Basic:
If request.form("txtDateRec") = "" then
'report error
Else
'do nothing
end if

This I thought would read the value out. It doesnt. When there is a value in the ASP:TEXTBOX it still thinks its blank.
I tried taking the check out and letting the code enter but then it inserts a blank value into the database, rather than the value from my ASP:TEXTBOX.

Anyone know if there is a problem gettting a value out of a ASP:TEXTBOX when it is inside a datalist?
 
Its all fixed!!!!
Basically, (for anyone that wants to know) the Request.Form element does not work with just the textbox name or ID. Instead, you need to pass the name of the textbox as it appears to the client!
(i.e. as it would appear if you viewed the Html source)

So My request.form("txtDateRec") did not work
But,
request.form("dgnews:ct10:txtdaterec") did work!!!

A handy thing to know when working inside a datalist!
 
Back
Top