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

Issue inserting null value into a formview/gridview control

P: n/a

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

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

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

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



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.