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
close icon

DatePicker Value Null inside Dialog

I Have Date Picker inside the ejDialog control, and I want to save in database, I testing different option what I find in forum,  but every time I receive null.
Testing:
var Fe = dp1.Value ; result null.
var Fe = dp1.Value.Value; result null
DateTime Fe = dp1.Value.Value; result null.

dpvaluenull
Thank You

5 Replies

TO Tomasz February 21, 2017 05:30 PM UTC

The problem is with ej:Dialog, put controls out side the dialog work fine, and the same when i create small form in bootstrap modal window.


TO Tomasz replied to Tomasz Vizaint February 21, 2017 05:32 PM UTC

The problem is with ej:Dialog, put controls out side the dialog work fine, and the same when i create small form in bootstrap modal window.

Mabe is necessary us in codebehind "FindControl" option ?


SN Sasikala Nagarajan Syncfusion Team February 22, 2017 12:29 PM UTC

Hi Tomasz,   
  
Sorry for the delay.  
  
We have checked with the reported query and we suspect that the issue may be caused due to components are not placed inside the form. This will happen if you didn’t specify the target id for Dialog control while rendering and in this case, Dialog will be appended to body tag (default behavior of Dialog) and which make all the components appended to body (outside of form).  So, these components won’t return their value in server side since it’s not taken into an account in form post (this is behavior in web forms).    
  
So, to resolve this issue please specify the targeted selector through API Target (Dialog will be displayed (positioned) based on its container).   
  
Please refer the below code example. Here we have kept the dialog inside the div element which is placed inside the form.   
  
<div ID="sample"> 
  <ej:Dialog ID="Dialog1" runat="server" Target="#sample"> 
        <DialogContent> 
          <p>This is a simple datepicker control</p>             
         <ej:DatePicker ID="Datepicker1" runat="server"></ej:DatePicker> 
       <ej:Button ID="Button1" Text="submit" OnClick="btn_Click" runat="server" ></ej:Button> 
   </DialogContent> 
  </ej:Dialog> 
 </div> 
  
For more information about EJ components, please check below link: 
  
Regards,   
Sasikala Nagarajan   



TO Tomasz February 22, 2017 08:13 PM UTC

Thank You. Exactly like you said, but, as I have site master for all the pages I have put id for form tag for example "frm" and the next one in dialog I have put Target = "# frm", and it goes well.
OKDialog
thank you so much


SN Sasikala Nagarajan Syncfusion Team February 23, 2017 05:11 AM UTC

Hi Tomasz,   
  
We are glad to hear that the problem is resolved at your end. Please let us know if you need any further assistance on this.  
  
We will happy to help you.  
  
Regards,   
Sasikala Nagarajan  


Loader.
Live Chat Icon For mobile
Up arrow icon