The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
I'm trying to use the DateTime textbox control with data binding. I assume that Value='<%# bind("column_name") %>' should work, and it appears to except in my first test the column returned from the database is NULL. I've set the EnableNullDate and EnableNullKeys = true. I've specified the NULLString = "". I haven't tried the IsNullDate=True yet but that seems out of place, I don't know the date will always be null to begin with. (I'll test that setting in a little bit)
Just wondering if I was missing something obvious?
LKLakxman Kumar C Syncfusion Team May 21, 2010 12:51 PM UTC
Hi James,
Thank you for your interest in Syncfusion Products.
Kindly follow the Direct-Trac incident created by you for further updates on this query.
Thank you for your participation in Syncfusion’s Community Forums.
Regards, Lakxman Kumar C
JKJames KnowltonMay 21, 2010 05:47 PM UTC
Sorry about the double posting, I submitted this one prior to the bug report. In the meantime while your development team researches the problem I instituted a workaround and am providing here in the event it might help someone else:
In the aspx page markup I bind the data value ONLY to the Text attribute of the control, then in the code behind I use the Databound event test the text value and set the control's value appropriately. Seems to work so far, though I have not tested updating the database with the controls end value.
Here is the code:
Private Sub dvBiographical__DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles dvBiographical_.DataBound ' ======================================================================================== ' Name: dvBiographical__DataBound ' Parameters: ' - sender (Object)(ByVal) : ' - e (EventArgs)(ByVal) : ' Returns: ' Author: James.Knowlton ' Desc: This routine handles the databound event for the dvBiographical_ control. ' NOTE: Normally I don't require any specialized code for this event (except when I want to provide custom/specialized formatting) ' I'm using this routine to manually set the "value" attribute of the syncfusion datetimeTextbox control ' which seems to lack proper dbNULL value handling. ' Hopefully this will only be a temporary solution until syncfusion provides an update or other workaround. ' ======================================================================================== ' MODS: ' 100521 - JLK - Initial Development ' ========================================================================================
'while unlikely, lets make sure... If sender Is Nothing Then Return 'take no action
'convert our sender object (I may want this routine to handle multiple DV's in which case I can use a generic variable name) Dim loDetailView_ As DetailsView = CType(sender, DetailsView)
'The Syncfusion controls are only present in the Edit Templates, so unless we are in edit mode we don't need to take any action If loDetailView_.CurrentMode = DetailsViewMode.Edit Then 'Get a reference to our problem control... Dim loControl_ As DateTimeTextBox = CType(loDetailView_.FindControl("dttbBirth_Date_"), DateTimeTextBox) 'if the text is empty then the database returned a null value, so handle appropriately If loControl_.Text Is Nothing OrElse loControl_.Text = String.Empty Then loControl_.IsNullDate = True 'tells the control it's dealing with a null (probably means I'll get a dbnull.value back when I send it back to the DB (I hope!) Else 'convert string to date and set the value ' NOTE: I doubt we could have anything other than a real date, but better safe than sorry. If IsDate(loControl_.Text) Then loControl_.Value = CType(loControl_.Text, DateTime) loControl_.IsNullDate = False Else loControl_.Text = "" loControl_.IsNullDate = True End If End If
End If 'loDetailView_.CurrentMode = DetailsViewMode.Edit
End Sub 'dvBiographical__DataBound
LKLakxman Kumar C Syncfusion Team May 26, 2010 11:12 AM UTC
Hi James,
Thank you for the workaround. Hope this will be usefull for someone who is in need of this untill the fix is available in our build.
Thank you for your participation in Syncfusion’s Community Forums.