<Bindable(True)> _
<DefaultValue(GetType(Date), Nothing)> _
<Themable(False)> _
Public Property Value() As Date
Get
Return CDate(ViewState("Value"))
End Get
Set
ViewState("Value") = Value
End Set
End Property
In a web application, if I select the control and change the Date value, then delete the date value (all from the property tool window) the rendered HTML (in the Source view) shows 'Value=""'. How can I get the control to remove the Value property in the
html source view when the value is empty (not DateTime.MinValue, which is what Nothing is converted to)?
How can I get the control to remove the Value property in the html source view when the value is empty (not DateTime.MinValue, which is what Nothing is converted to)?
What does that mean?Do you want to not show the property in the aspx codes of the control in HTML?
I would rather the Value property be removed with the Value is an empty string, since really, the Value is a Date property and not a String. DefaultValue usually takes care of this, but since it's a Date, doesn't work out so well from what I've tried. I would like it to go back to the following when the date is deleted:
Mythran
Participant
924 Points
206 Posts
Prevent Rendering Property (type Date) In Designer When Empty
Apr 05, 2012 03:33 PM|LINK
I have a property that's of type Date as follows:
<Bindable(True)> _ <DefaultValue(GetType(Date), Nothing)> _ <Themable(False)> _ Public Property Value() As Date Get Return CDate(ViewState("Value")) End Get Set ViewState("Value") = Value End Set End PropertyIn a web application, if I select the control and change the Date value, then delete the date value (all from the property tool window) the rendered HTML (in the Source view) shows 'Value=""'. How can I get the control to remove the Value property in the html source view when the value is empty (not DateTime.MinValue, which is what Nothing is converted to)?
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Prevent Rendering Property (type Date) In Designer When Empty
Apr 07, 2012 02:11 AM|LINK
What does that mean?Do you want to not show the property in the aspx codes of the control in HTML?
Mythran
Participant
924 Points
206 Posts
Re: Prevent Rendering Property (type Date) In Designer When Empty
Apr 07, 2012 03:59 PM|LINK
What I mean is, when I first drag and drop the control on the page, I get something like this:
Then when I change the Value property in the property tool window to a date and press enter, I get this:
When I select the date in the property tool window and delete the date and press enter, I end up getting this:
I would rather the Value property be removed with the Value is an empty string, since really, the Value is a Date property and not a String. DefaultValue usually takes care of this, but since it's a Date, doesn't work out so well from what I've tried. I would like it to go back to the following when the date is deleted: