GridView problems.

Joined
Jun 21, 2007
Messages
2
Reaction score
0
Hello,

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!!! :cheers:
 
Joined
Jun 21, 2007
Messages
2
Reaction score
0
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.dbo.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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top