This question is locked. New answers and comments are not allowed.
I need to display a date as a non-modifiable string.
It used to show on a calendar, getting ContractStart value of type DateTime.
I want something like below, where ViewBag.ContractStart has been changed to a string type :
.Name("StartDate")
.Value(ViewBag.ContractStart))</dt>
but LabelFor doesn't seem to be an option.
Not sure how to make it work with Telerik().HtmlHelper() either.
Links to documentation and/or examples are appreciated!
thanks
Jane
It used to show on a calendar, getting ContractStart value of type DateTime.
<dt>@(Html.Telerik().DatePicker() .Name("StartDate") .Value((DateTime?)ViewBag.ContractStart)) </dt>I want something like below, where ViewBag.ContractStart has been changed to a string type :
<dt>@(Html.Telerik().LabelFor().Name("StartDate")
.Value(ViewBag.ContractStart))</dt>
Not sure how to make it work with Telerik().HtmlHelper() either.
Links to documentation and/or examples are appreciated!
thanks
Jane
9 Answers, 1 is accepted
0
Hi,
the Telerik team
Why don' you output the value like this?:
@ViewBag.ContactStart
Regards,
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the Telerik Extensions for ASP.MET MVC, subscribe to their blog feed now
0
Jane
Top achievements
Rank 1
answered on 03 Feb 2012, 09:42 PM
It shows correct string initially, but when ViewBag.StartDate value is updated it is not shown.
0
Hello,
Atanas Korchev
the Telerik team
I am sorry but I don't understand what the problem is. An ASP.NET MVC view will display all updated values once rendered.
Regards,Atanas Korchev
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Jane
Top achievements
Rank 1
answered on 06 Feb 2012, 06:24 PM
When the page loads, ViewBag.StartDate has a value, and it is displayed correctly.
However, a user gets to change other values on the page (select different entries in drop downs, etc..), which causes ViewBag.StartDate value to be set to a different date. The page is not rendered again, but I need the updated value to show up.
However, a user gets to change other values on the page (select different entries in drop downs, etc..), which causes ViewBag.StartDate value to be set to a different date. The page is not rendered again, but I need the updated value to show up.
0
Hello,
Atanas Korchev
the Telerik team
I still don't understand what the problem is. How is the ViewBag.StartDate updated without a request to the server side?
All the best,Atanas Korchev
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Jane
Top achievements
Rank 1
answered on 07 Feb 2012, 04:10 PM
There is a request to the server side, the ViewBag is updated on the server call.
0
Hi,
Atanas Korchev
the Telerik team
Perhaps you can return the date as a result of this server request and update it in the view using JavaScript. Even if there were a component showing readonly dates you still would need to update it using code in this case.
Kind regards,Atanas Korchev
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
0
Jane
Top achievements
Rank 1
answered on 07 Feb 2012, 06:02 PM
Yes, that would be fine.
Can you point me to an example, or documentation for relevant JavaScript calls?
Can you point me to an example, or documentation for relevant JavaScript calls?
0
Hello,
Atanas Korchev
the Telerik team
Since we don't offer this behavior out of the box we don't have any examples or documentation. You can however search online
All the best,Atanas Korchev
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>