We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Control datepicker inside a FormView inside an UpdatePanel





Every time I try to save the value of the datepicker the value comes out null, I know that this happens to be inside an updatepanel, I have put the formview as AsyncPostBackTrigger, but still if I select the value. I also put the code from the server in C # but it does not work. I take the data from a SqlDatasource.




SCREEN





C#
 protected void Persona_estudiosSqlDataSource_Inserting(object sender, SqlDataSourceCommandEventArgs e)
    {
        try
        {
            e.Command.Parameters[0].Value = Id_personaHiddenField.Value;
            e.Command.Parameters[1].Value = ((DropDownList)CentroEstudiosFormView.FindControl("CentroestudiosDropDownList")).SelectedValue;
            e.Command.Parameters[2].Value = ((Syncfusion.JavaScript.Web.DatePicker)CentroEstudiosFormView.FindControl("DesdeDatePicker")).Value;
            e.Command.Parameters[3].Value = ((Syncfusion.JavaScript.Web.DatePicker)CentroEstudiosFormView.FindControl("HastaDatePicker")).Value;
        }
        catch (Exception ex)
        {

            ErrorMessage.Text = "Insertar centro de estudios: " + ex.Message;
        }
    }

2 Replies

RA Roger Alberto February 7, 2019 04:49 PM UTC

Already solved. I put the code below. Now I'm going to test with the other controls (combox, Dropdownlist, ETC). :)




protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {

            Syncfusion.JavaScript.Web.DatePicker DesdeCE_dtp = ((Syncfusion.JavaScript.Web.DatePicker)CentroEstudiosFormView.FindControl("DesdeDatePicker"));
            Syncfusion.JavaScript.Web.DatePicker hastaCE_dtp = ((Syncfusion.JavaScript.Web.DatePicker)CentroEstudiosFormView.FindControl("HastaDatePicker"));
            
            ScriptManager.GetCurrent(Page).RegisterAsyncPostBackControl(DesdeCE_dtp);
            ScriptManager.GetCurrent(Page).RegisterAsyncPostBackControl(hastaCE_dtp);
          }
     }


PO Prince Oliver Syncfusion Team February 8, 2019 05:23 AM UTC

Hi Roger, 

Thank you for your update. 

We are glad the issue is resolved in your end. Please let us know, if you face any issues. 

Regards, 
Prince 


Loader.
Live Chat Icon For mobile
Up arrow icon