Hi Kerry,
[quoted text, click to view] >I have declared my textbox as a control in my codebehind.
I think the box shgould be declared as a TextBox as a
Control does not have a Text property.
In all of my code-behind modules, here is what my
declarations look like :
Protected WithEvents textbox1 As
System.Web.UI.WebControls.TextBox
This is how the designed would create the refernce if you
were to drag a text box control from the toolbox.
Also, is your textbox contained within another server-
side control ? Perhaps a panel ? It is the case, you must
use oParentControl.FindControl("textbox1").
Another safe way to reference your text box is :
Dim txt as TextBox
txt = Page.FindControl("testbox1") and check if txt is
nothing.
Hope this helps,
Ben
[quoted text, click to view] >-----Original Message-----
>Hi,
>
>I have an aspx page with some server side textboxes.
>
>I have a button onmy page which allows users to add data
>to a database.
>
>In my onclick event for my button when I try and get teh
>value from the textbox using..
>
>Dim myString as String = textbox1.text
>
>...it is blank.
>
>When I do a..
>
>Dim myString = Request.Form("textbox1")
>
>...I get the value the user enetered.
>
>I have declared my textbox as a control in my codebehind.
>
>And it is an asp.net textbox.
>
>Any ideas why this is?
>
>This is baffling me.
>
>Kerri.
>.
Kerri,
Have you set the TextMode of your TextBox to MultiLine? I have run into =
a similar problem using a TextBox that is set this way. The text =
entered by the user does not seem to be returned. Text that is =
pre-loaded is displayed and returned, but no modifications to it by the =
user are returned.
I have only seen this behavior with MultiLine TextBoxes.
Regards,
Joel Finkel
finkel@sd-il.com
[quoted text, click to view] "Kerri" <anonymous@discussions.microsoft.com> wrote in message =
news:030b01c39cc4$513162e0$a301280a@phx.gbl...
> Hi,
>=20
> I have an aspx page with some server side textboxes.
>=20
> I have a button onmy page which allows users to add data=20
> to a database.
>=20
> In my onclick event for my button when I try and get teh=20
> value from the textbox using..
>=20
> Dim myString as String =3D textbox1.text
>=20
> ..it is blank.
>=20
> When I do a..
>=20
> Dim myString =3D Request.Form("textbox1")
>=20
> ..I get the value the user enetered.
>=20
> I have declared my textbox as a control in my codebehind.
>=20
> And it is an asp.net textbox.
>=20
> Any ideas why this is?
>=20
> This is baffling me.
>=20
Don't see what you're looking for? Try a search.