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

Issue inserting null value into a formview/gridview control

P: n/a
Hi,

My formview or gridview control stops updating or deleting a record
once the record has a null value.

I have table tblTest with the following

pkID int NOT NULL **IDENTITY COLUMN**
string1 varchar(30)
string2 varchar(30)

I then create a SqlDataSource with the statement:

Select * From [tblTest]

I have the insert, update and delete statements generated, and choose
optimistic concurrency. I add a couple records of dummy data.

I then drag a Formview control onto the page, and bind it to the
SqlDataSource I just created. I then fire it up in my browser, and I
can then update, insert and delete records. However, as soon as I
update a record with a null value, I can no longer update or delete
that record.

So, if I had a record in my FormView like:

string1: foo
string2: bar

I can update and delete normally. And when I update to:

string1: foo
string2:

the database correctly inserts a null value into string2. However, once
that null is in the record, I can't change anything about the record.
If I try to delete the record, the FormView will then display the
previous record, but I can still page to the record that should have
been deleted, and it still exists in the db. If I try to update the
record, the edits I make will not keep and the process will fail
silently.

What am I doing wrong? Should i be binding to a different object?

Regards,

Chris

Jan 14 '07 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.