RadDatePicker save mindate instead of null

2 posts, 0 answers
  1. lakmal
    lakmal avatar
    76 posts
    Member since:
    Jun 2009

    Posted 19 Oct 2009 Link to this post

    Hi,

    this is my  datepicker   <telerik:RadDatePicker ID="RadReceiveAFCA"     
                                                         DbSelectedDate='<%# Bind("ReceiveAFCA")  %>'
                                                         DateInput-DateFormat="dd/mmm/yyyy"   SharedCalendarID="sharedCalendar"  
                                                         Width="100px"    runat="server">
                                                     <DateInput ID="DateInput1" runat="server" DateFormat ="dd/MM/yyyy"  DisplayDateFormat="dd/MM/yyyy" />
                                                    </telerik:RadDatePicker>

    When i save null date table has mindate. (1/1/1900 ). How can i stop saving min date and save null?

    This is my save code

     string sqlStr = "update  tbl_DATA_Docs set     DocuStartP     =    '" + dtpDocStart.SelectedDate  + "'    ,    " +
                                "    DocuStartF     =    '" + RadDocuStartF.SelectedDate + "'    ,    " +
                                "    DocuEndP     =    '" + RadDocuEndP.SelectedDate + "'    ,    " +
                                "    DocuStartA     =    '" + RadDocuStartA.SelectedDate + "'    ,    " +
                                "    DocuEndF     =    '" + RadDocuEndF.SelectedDate + "'    ,    " +
                                "    DocuEndA     =    '" + RadDocuEndA.SelectedDate + "'    ,    " +
                                "    SubmitForIDCP     =    '" + RadSubmitForIDCP.SelectedDate + "'    ,    " +
                                "    SubmitForIDCF     =    '" + RadSubmitForIDCF.SelectedDate + "'    ,    " +
                                "    SubmitForIDCA     =    '" + RadSubmitForIDCA.SelectedDate + "'    ,    " +
                                "    ReturnFromIDCP     =    '" + RadReturnFromIDCP.SelectedDate + "'    ,    " +
                                "    ReturnFromIDCF     =    '" + RadReturnFromIDCF.SelectedDate + "'    ,    " +
                                "    ReturnFromIDCA     =    '" + RadReturnFromIDCA.SelectedDate + "'    ,    " +
                                "    IssueForCommentsP     =    '" + RadIssueForCommentsP.SelectedDate + "'    ,    " +
                                "    IssueForCommentsF     =    '" + RadIssueForCommentsF.SelectedDate + "'    ,    " +
                                "    IssueForCommentsA     =    '" + RadIssueForCommentsA.SelectedDate + "'    ,    " +
                                "    ClientReturnedCommentsP     =    '" + RadClientReturnedCommentsP.SelectedDate + "'    ,    " +
                                "    ClientReturnedCommentsF     =    '" + RadClientReturnedCommentsF.SelectedDate + "'    ,    " +
                                "    ClientReturnedCommentsA     =    '" + RadClientReturnedCommentsA.SelectedDate + "'    ,    " +
                                "    ReceiveForCommentsP     =    '" + RadReceiveForCommentsP.SelectedDate + "'    ,    " +
                                "    ReceiveForCommentsF     =    '" + RadReceiveForCommentsF.SelectedDate + "'    ,    " +
                                "    ReceiveForCommentsA     =    '" + RadReceiveForCommentsA.SelectedDate + "'    ,    " +
                                "    IncorporateCommentsP     =    '" + RadIncorporateCommentsP.SelectedDate + "'    ,    " +
                                "    IncorporateCommentsF     =    '" + RadIncorporateCommentsF.SelectedDate + "'    ,    " +
                                "    IncorporateCommentsA     =    '" + RadIncorporateCommentsA.SelectedDate + "'    ,    " +
                                "    IssueForApprovalP     =    '" + RadIssueForApprovalP.SelectedDate + "'    ,    " +
                                "    IssueForApprovalF     =    '" + RadIssueForApprovalF.SelectedDate + "'    ,    " +
                                "    IssueForApprovalA     =    '" + RadIssueForApprovalA.SelectedDate + "'    ,    " +
                                "    ClientReturnFromIFAP     =    '" + RadClientReturnFromIFAP.SelectedDate + "'    ,    " +
                                "    ClientReturnFromIFAF     =    '" + RadClientReturnFromIFAF.SelectedDate + "'    ,    " +
                                "    ClientReturnFromIFAA     =    '" + RadClientReturnFromIFAA.SelectedDate + "'    ,    " +
                                "    ReceiveForComments2P     =    '" + RadReceiveForComments2P.SelectedDate + "'    ,    " +
                                "    ReceiveForComments2F     =    '" + RadReceiveForComments2F.SelectedDate + "'    ,    " +
                                "    ReceiveForComments2A     =    '" + RadReceiveForComments2A.SelectedDate + "'    ,    " +
                                "    IncorporateComments2P     =    '" + RadIncorporateComments2P.SelectedDate + "'    ,    " +
                                "    IncorporateComments2F     =    '" + RadIncorporateComments2F.SelectedDate + "'    ,    " +
                                "    IncorporateComments2A     =    '" + RadIncorporateComments2A.SelectedDate + "'    ,    " +
                                "    IssueForAFCP     =    '" + RadIssueForAFCP.SelectedDate + "'    ,    " +
                                "    IssueForAFCF     =    '" + RadIssueForAFCF.SelectedDate + "'    ,    " +
                                "    IssueForAFCA     =    '" + RadIssueForAFCA.SelectedDate + "'    ,    " +
                                "    ReceiveAFCP     =    '" + RadReceiveAFCP.SelectedDate + "'    ,    " +
                                "    ReceiveAFCF     =    '" + RadReceiveAFCF.SelectedDate + "'    ,    " +
                                "    ReceiveAFCA     =    '" + RadReceiveAFCA.SelectedDate + "'    ,    " +
                                "    OURACTION     =    '" + RadOURACTION.SelectedDate + "'    ,    " +
                                "    Progress     =    '" + txtProgress.Text + "'    ,    " +
                                "    CLIENTACTION     =    '" + RadCLIENTACTION.SelectedDate + "'    where DocNo= '" + DocNo + "'";

                SqlCommand cmd = new SqlCommand(sqlStr, Conn);
                cmd.ExecuteNonQuery();
                ltrPlan.Text = "<SPAN style='color=blue'><br>Succesfully Updated<br></SPAN>";
                cmd.Dispose();


  2. Johny
    Johny avatar
    80 posts
    Member since:
    Aug 2008

    Posted 22 Oct 2009 Link to this post

    Hi Lakmal,

    I don't think that this is related to the DbSelectedDate property of the radDatePicker. Here is the code I tried:

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> 
     
    <%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> 
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    <html xmlns="http://www.w3.org/1999/xhtml"
    <head runat="server"
        <title></title
    </head> 
    <body> 
        <form id="form1" runat="server"
        <div> 
            <asp:ScriptManager ID="ScriptManager" runat="server"
            </asp:ScriptManager> 
            <telerik:RadCalendar runat="server" ID="sharedCalendar"
            </telerik:RadCalendar> 
            <telerik:RadDatePicker AutoPostBack="true" ID="RadReceiveAFCA"  
                DateInput-DateFormat="dd/mmm/yyyy" SharedCalendarID="sharedCalendar" Width="100px" 
                runat="server" OnSelectedDateChanged="RadReceiveAFCA_SelectedDateChanged"
                <DateInput ID="DateInput1" runat="server" DateFormat="dd/MM/yyyy" DisplayDateFormat="dd/MM/yyyy" /> 
            </telerik:RadDatePicker> 
        </div> 
        </form> 
    </body> 
    </html> 

    And in the code behind

    protected void RadReceiveAFCA_SelectedDateChanged(object sender, Telerik.Web.UI.Calendar.SelectedDateChangedEventArgs e) 
        { 
            Response.Write(string.Format("DbSelectedDate is: {0}",RadReceiveAFCA.DbSelectedDate == null ? "Null" : RadReceiveAFCA.DbSelectedDate)); 
        } 

    So I guess that your database applies a default value when it receives a null object from the picker.

    I hope this helps.
    Johny



  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top