<asp:Parameter Name="comment" ConvertEmptyStringToNull="false" Type="string" /
I even tried settting ConvertEmptyStringToNull to "false" but got nowhere.
I can do this by directly by handling the Updating event of the SqlDataSource, but that's a lot of code. Is there a better way?
I don't know whether this is what you are looking for. Use a space for the DefaultValue.
<UpdateParameters>
<asp:ParameterName="comment"DefaultValue=" "Type="String"/></UpdateParameters>|||You have to set to ConvertEmptyStringToNull="false" on both the Parameter, and the BoundField control.
For example:
<
asp:BoundFieldDataField="locationName"HeaderText="Location Name"SortExpression="locationName"ConvertEmptyStringToNull="false"/><
asp:ParameterName="locationName"Type="String"ConvertEmptyStringToNull="false"/>|||Hi,
This was a great help, I have been teaching myself ASP.NET and it was the first stumbling block. I was following "SAMS Teach Yourself ASP.NET (24Hrs)" and was on the datagrid view section. It was advising me to set the column value (which was set to not allow nulls) to still be able to except a blank entry. This was supposedly achieved by editing the value via the smart tag and then setting the ConvertEmptyStringToNull, which I did. But still failed with the error "Null expected".
I followed the manual method described above and edited the source code and it worked!
My question is if this is a bug with Visual Studio Express? That is the smart tag function is not updating the Parameter. I had to manually edit the source code in order to get it to work as above. Are there other areas that Visual Studio does not via Design view update the source code side of things?
Regards X
Hi exup,
There are a lot of demos showing how complex web pages can be done without digging into code. The problem is that, unless you want your pages to perform exactly like the demos, you will need to dig into code.
"Teach yourself asp.net in 24 hours" as a book title sets up a somewhat unrealistic expectation. Asp.net is complicated, and needs time to master. I'd give yourself a few months to get comfortable with all of the quirks.
John
No comments:
Post a Comment