Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: SV: 1st timer: problem in retrieving the value of Text control in .NET Web form


Message #1 by "Jan Arve Dyrnes" <jan.arve@c...> on Thu, 24 Oct 2002 17:25:21 +0200
Thanks Jana,

The CustomerID is varchar field in database.  Also, I didn't bind any 
control to database/column. Neither do I use IsPostBack condition (I tried 
it, and it doesn't matter). I use MS Data Application Blocks to retrieve 
data from database, and then assign/retrieve them to/from the text 
controls programmatically.

The data are showing fine, but I just can't get the updated value from the 
text control. I tried to create a simple form within the project, with one 
label, one text, and button. I get the same issue, which leads me 
wondering if I miss some settings either in form or application level.

May I send the code to U personally?

> 
I don't have all your code and than it's hard to say whatâ??s wrong.

First:
arParams[0] = new SqlParameter("@CustomerID",txtCustomerID.Text);

I assume the CustumerID is of type SQLDBType.int, 4.
If so you have to convert you txtCustumerID.txt. Like this
Int32.parse(txtCustomerID.Text).

If this doesn't solve your problem. I guess you Databind you form controls
on each Page_load().

Then you should have a look at the
if (!Page.IsPostBack)
{
	databind();
}

The you are sure that you don't dataBind your form controls before update
();

Hope this help,
jana

-----Opprinnelig melding-----
Fra: use4forums@y... [mailto:use4forums@y...]
Sendt: 24. oktober 2002 16:05
Til: ASPX_Professional
Emne: [aspx_professional] 1st timer: problem in retrieving the value of
Text control in .NET Web form


I run into a problem of retrieving the value of Text control in one of the
web forms. Any suggestions would be appreciated.

Here is the situation:
The page loads the data from database to each text fields on the form
first.  The user then update the data, and click a Save button.
Supposedly, it will take the new value and save it back to database.  For
some reasons, the codes in the Save_Click method are unable to retrieve
the new value.  The following is one of the C# statements:

arParams[0] = new SqlParameter("@CustomerID",txtCustomerID.Text);

The ReadOnly property of the control was set to "false", and there is no
change to that property in the codes.

Notes:
1. The text controls are not binding to any data source column, but
programmatically assigned the value instead.
2. The user was transferred from the other page with a QueryString which
is used as data retrieving criteria by this page.

Thanks in advance for your help.

Michael J.
---

ASP.NET 1.0 Namespace Reference with C#
http://www.wrox.com/acon11.asp?ISBN=1861007442

ASP.NET 1.0 Namespace Reference with VB.NET
http://www.wrox.com/acon11.asp?ISBN=1861007450

These books are a complete reference to the ASP.NET namespaces
for developers who are already familiar with using ASP.NET.
There is no trivial introductory material or useless .NET
hype and the presentation of the namespaces, in an easy-to use
alphabetical order ensures a user-friendly reference format.
We provide in-depth coverage of all the major ASP.NET classes,
giving you those real-world tips that the documentation doesn't
offer, and demonstrating complex techniques with simple
examples.

---
---
Change your mail options at http://p2p.wrox.com/manager.asp or
to unsubscribe send a blank email to




  Return to Index