Unable to cast object...with datapicker - asp.net

I got the famous error "InvalidCastException was unhandled by user code"
Unable to cast object of type 'System.DateTime' to type 'System.String'
But I have not found the solution to my problem on the forum.
First I have no type "string" because my form contains only a datapicker.
Secondly, the field is a smalldatetime in my SQL database.
So, I don't know why it says that!?
The Error appears in the automatic file "my_program.Web.g.vb" when i input a date (from Datapicker) into my form.
[Error on my_programm.Web.g.vb]http://img4.hostingpics.net/pics/854888Untitled.png
Here is the field of my form:
<dataFormToolkit:DataField>
<sdk:DatePicker SelectedDate="{Binding StartingDate, Mode=TwoWay}"/>
</dataFormToolkit:DataField>
Have you an idea for this problem?
Thank you in advance
Cordially

It was very stupid
In addition to the conversion that I did as you suggested, I left a "StringLength(..)" tag dragged in another part of the code -__-
Really sorry for the inconvenience and thank you
Cordially

Related

og:locale fr_BE not recognized

I'm getting the following error:
of type 'website' is invalid because the given value 'fr_be' for property 'og:locale:locale' could not be parsed as type 'enum'.
After looking at https://developers.facebook.com/docs/messenger-platform/messenger-profile/supported-locales/, I wonder why fr_BE is not supported, but nl_BE is.
Is there a specific reason, or is this a bug?
Thank you.
Best regards

Thymeleaf Pagination Url Failed to Convert String to Long

So I'm trying to paginate results where I have a page with a path variable, and the Thymeleaf th:href keeps telling me Failed to convert value of type 'java.lang.String' to required type 'java.lang.Long'
So I added an object called "StudySet" to the model in my controller method, like this
modelAndView.addObject("studySet", studySetById);
And then I try to use it in a th:href in my HTML like this
th:href= "#{${studySet.id}/?page=} + ${page}"
But my URL just shows up like this
http://localhost:8080/studySet/$%7BstudySet.id%7D/?page=2
When I want it to look like this
http://localhost:8080/studySet/8/?page=2
8 is the id of the "studySet" object.
So if anyone has any idea on what I'm doing wrong and could let me know, that would be awesome, thanks.
ok, I reproduced your problem and here is a solution:
th:href= "#{{studySetid}/?page={page}(studySetid=${studySet.id},page=${page})}"
here is a reference for further reading

SqlDataSource erroring when retrieving NVARCHAR(max) column

I'm writing a small ASP .Net application in order to retrieve data from a SQL database. The application uses drop downs in order to select what the next drop down should contain and when a page is selected, it should retrieve the HTML from the database. Everything is working until it gets to the retrival of the HTML data. When I try to retrieve the data, I get:
Microsoft JScript runtime error:
Sys.WebForms.PageRequestManagerServerErrorException:
An unknown error occurred while
processing the request on the server.
The status code returned from the
server was: 500
The HTML column is a defined as NVARCHAR(MAX), but I can't see this causing a problem. The application works if I set the DataValueField to another column. Has one else come across a problem like this? Maybe someone could shine some light on this?
One thing I noted when dealing with varchar(max) columns is that the framework still commonly expects to have a size associated with it. What I ended up having to do was specify the length as -1 to get it to accept a varchar(max) field. Your error message doesn't indicate that this is the problem, but you might try experimenting with it rather than turning off the validation, which could possibly have other repercussions.
Figured it out. Just needed to set ValidateRequest to false at the Page level.

Error pasting data into a TextInput

In my Flex 4 application I have a spark text input. When the user pastes data from clipBoard it throws error if the clipBoard contains a different format (other than string). This is the error message i am getting.
"TypeError: Error #1009: Cannot access a property or method of a null object reference.
at spark.components::RichEditableText/handlePasteOperation()
[E:\dev\4.0.0\frameworks\projects\spark\src\spark\components\RichEditableText.as:3611]"
Is there any way to handle this?
Thanks
Manoj
It looks like this is a known problem. The only suggestion I could find was from rdermer on one of those threads:
If you have a local copy of TLF 1.1
you can work around it by adding a
test at line 346 of TextClipboard.as.
Replace
endArray.push(curFlElement); with
if (curFlElement)
endArray.push(curFlElement); That prevents the bug - but the
underlying cause needs more
investigation.

RunTimeError in ASP.Net

I am doing .net application which is in vb.I am getting an runtime error when running in Internet Explorer,but its running in mozilla. Error as following
Error:SysArgumentTypeException:Object
of type
'AjaxControlToolKit.Animation.Length
Animation' cannot be converted to type
;AjaxControlToolKit.Animation'.Parameter
Instance.
Error is getting in MicrosoftAjax.debug.js
if(!this.isInstanceOfType(instance)) throw Error.argumentType('instance',ObjectgetType(instance))
What may be the reason for this error.What can i do to resolve this? Can anybody help?
The error indicates, that you are trying to cast a type called Length Animation to a type called Parameter. In VB and VB.NET, the cast is tried implicitly if the types of an assignment doesn't match. Please have a further look at the stack-trace to find the exact line of the error.
PS: I didn't know that there could be spaces in a .NET type name...

Resources