using jqui:DatePicker inside formview asp.net control

Mar 27, 2012 at 11:38 AM

Ciao

first of all thank you and congratulations for the controls

The first function very well, also Data Bind,  but when  FormView  ChangeMode  the control no longer works

I think it's a problem loading


you have any solution to remedy this problem?

hanks for your response and good work

guido

Coordinator
Mar 27, 2012 at 11:56 AM
Edited Mar 27, 2012 at 11:58 AM

Hi Guido,

I have actually not run across this issue yet, maybe because I rarely use the FormView control. Can you give me some more input on the actual scenario, so I can test it? For example, are you using an UpdatePanel to refresh the FormView control? Can you verify, whether the required jQuery UI library has been included when the page is loaded? Also, which version of DNN are you using? I know there are issues with DNN>=6, since it brings its own version of jQuery and jQuery UI. I need to adapt this package for it to work with DNN6.

Thanks
   Christoph

Mar 27, 2012 at 12:30 PM

Ciao Christoph

Use the FormView control in an ascx user control (I'm using vb.net)

 

the design files replace    <asp:TextBox ID="DataNascitaTextBox" runat="server"  Text='<%# Bind("DataNascita") %>' />

with    <jqui:DatePicker runat="server" id="dateTest" locale="de" showon="Button" zindex="3" Text='<%# Bind("DataNascita") %>'/>


is <EditItemTemplate>  that  <InsertItemTemplate>

I found this on the internet on this problem

JQuery UI DatePicker control is an excellent and easy to use system to handle input dates in a web page. As we have seen in the script # 1000, it is typically activated by inserting in the page of javascript code like the following, for example, which combines the functionality to all input elements whose class is equal to dateBox CSS.

<script type="text/javascript">
  $(function () {
      $('.dateBox').datepicker();
  });
</script>

If you're using an UpdatePanel, however, does not mean that all the elements that we are to make date picker are already present on the first page load, but could be added as a result of an asynchronous postback. The attached project, for example, a Button has an event that triggers the server side to show a couple of TextBox, but nothing changes even in more complex cases, like that of a FormView control to change its mode of operation.

n such situations we can use the event pageLoad of ASP.NET AJAX to achieve the desired result:

<script type="text/javascript">
    function pageLoad() {
        $(function () {
            $('.date').datepicker();
        });
    }
</script>
but as this can be applied to the control jqui:DatePicker ?

Thanks
guido
Coordinator
Mar 27, 2012 at 12:46 PM

Hmmm, I guess the quick fix would be to disable the UpdatePanel.

What I can also think of, is that the library did not get included in the first page load, so you might be able to add a manual call to the method HeroldIT.Dnn.JQuery.UI.JQueryUI.RegisterJQueryUI(Me.Page) to your UserControl's Init event. (Sorry, I'm no VB man, so the syntax may vary :-) )

Everything else would require an update of the library. Please see, if the manual call fixes your issue. If not, I'll try to reproduce the error and see what I can do.

Coordinator
Mar 27, 2012 at 12:50 PM

Ah, I just checked the code, but the datepicker initialization code is added to the internal jQuery document ready function list, so the manual call probably won't do it. But please try anyways.

Mar 27, 2012 at 2:10 PM

Ciao

if imposed   the DNN module does not support the partial redering the program is working

 

guido

my e-mail is guido@leonardo.ve.it