Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > GridView problems.

Thread Tools

GridView problems.

DrunkenSeer DrunkenSeer is offline
Junior Member
Join Date: Jun 2007
Posts: 2

Should first of all say I am very new to ASP.NET and i am currently working my way through several books however I have come accross a problem.
I am using Visual Studio Expression.

I have a SQLDatasource that has several Columns
Title, Author, LastRead, PageCount.

I have the Title set to not allow Nulls.

Now the issue I am having is that I have set up a GridView with edit enabled.

I have the title field set to ReadOnly so people cannot change the title however when updating it says cannot insert Null value.

I have therefore set the ConvertEmptyStringToNull="false" on the boundfield as well as the InsertParameter and UpdateParamter for 'Title'

Yet I am still getting the exception cannot insert Null Value into 'Title'

can anyone help? The book I am using tells me that it will work with the ConvertEmptyStringToNull will work yet it doesn't. Am I missing sumthin here?

Any help will be.... well.... Greatly appreciated!!!
Reply With Quote
DrunkenSeer DrunkenSeer is offline
Junior Member
Join Date: Jun 2007
Posts: 2
Can no-one help?? it is happening again this time with columns that are not even on the gridview.

i.e. the gridview shows title and image author and price yet if I try an edit a column it says I cannot insert a null value into Year Published?!?

seems all a bit mad to me.

[SqlException (0x80131904): Cannot insert the value NULL into column 'YearPublished', table 'C:\DOCUMENTS AND SETTINGS\CHRISTOPHER HANCOCK\DESKTOP\R&D\VISUAL WEB\DATABASEHOUR13+\APP_DATA\MYFIRSTDATABASE.MDF.d bo.Books'; column does not allow nulls. UPDATE fails.
The statement has been terminated.]

How do I solve this as I will not be able to create any editable gridviews where this keeps happening.
Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
GridView Hierarchical View - Gridview in Gridview =?Utf-8?B?bWdvbnphbGVzMw==?= ASP .Net 1 05-09-2006 06:48 PM
Gridview inside Gridview little problems... Carlos Albert ASP .Net 1 12-06-2005 05:31 PM
GridView in a GridView Carlos Albert ASP .Net 2 12-06-2005 12:42 PM
GridView in a GridView Nalaka ASP .Net 6 12-05-2005 05:48 PM
Gridview with combobox whose data is dependent on field in gridview ASP .Net 3 11-21-2005 05:34 PM