C
C#16mo ago
XANDRO

❔ Datepicker in ASP NET MVC 5 app

I'm trying to add datepicker in my app but It doesn't work
16 Replies
XANDRO
XANDRO16mo ago
JQuery
XANDRO
XANDRO16mo ago
XANDRO
XANDRO16mo ago
Controller expects userInput in this case that will be the value from dateTime
Angius
Angius16mo ago
<input type="datetime-local" /> not good enough? Ah, it's the old ASP? Some of the browsers you support probably won't support native date pickers, then
XANDRO
XANDRO16mo ago
Hmm But how I will get that value from <input> to controller?
Angius
Angius16mo ago
DateTime type parameter?
XANDRO
XANDRO16mo ago
Can i somehow pass it to string? My method is expecting string userInput Im not passing this date to any object
Angius
Angius16mo ago
Why do you even need it, then?
XANDRO
XANDRO16mo ago
Because those are filter options There is couple of options and some requires string input
Angius
Angius16mo ago
And you filter by date... as a string
XANDRO
XANDRO16mo ago
But wait If I change string to dateTime My datePicker should work? Do i need to add some ID on that html tag you sent me?
Angius
Angius16mo ago
¯\_(ツ)_/¯ Haven't used jQ in probably over a decade No clue And no, no id needed A name however, yes
XANDRO
XANDRO16mo ago
Then how tag will know where to be passed?
Angius
Angius16mo ago
The name Was about to say that you should generally prefer actual tags instead of @Html helpers on the first place, but then I was reminded you're using some dusty version of MVC, so ¯\_(ツ)_/¯ To be fair, I can't be 100% sure anything i say will work for you It will work in modern versions, dunno how it was back in ye olde days
XANDRO
XANDRO16mo ago
Okay thanks anyway
Accord
Accord16mo ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.