Well, javascript was really the best way, so I had to spend some time learning the basics.
I created a new script, equal to the calendarPopup, with the following differences:
- cmdAddException.NavigateUrl = DotNetNuke.Common.Utilities.Calendar.InvokePopupCalForCbo(lstExceptions), where InvokePopupCalFor receives the lstExceptions dropdown control instead of a texbox control;
-
calPopupSetDateCbo.arguments[0].options[calPopupSetDateCbo.arguments[0].length] = new Option(calPopupSetDateCbo.arguments[1], calPopupSetDateCbo.arguments[1], true, true), to retrieive a new item to the dropdownlist (before it was calPopupSetDate.arguments[0].value = calPopupSetDate.arguments[1], for the textbox);
My html is the following:
<asp:hyperlink id="cmdAddException" runat="server" text="Adicionar Excepção" CssClass="CommandButton" BorderStyle="None" resourcekey="cmdAddException"></asp:hyperlink>
<asp:DropDownList id="lstExceptions" Runat="server" cssclass="NormalTextBox" DataTextField="ExceptionDate"DataValueField="ExceptionId" AutoPostBack="false" Width="100"></asp:DropDownList>
and my web page source is:
<a id="dnn_ctr429_PlanoformEdit_cmdAddException" class="CommandButton" href=" popupCalCbo('Cal','dnn_ctr429_PlanoformEdit_lstExceptions','dd-MM-yyyy','Janeiro,Fevereiro,Março,Abril,Maio,Junho,Julho,Agosto,Setembro,Outubro,Novembro,Dezembro','dom,seg,ter,qua,qui,sex,sáb','Today','Close','Calendar',1);" style="border-style:None;">Adicionar Excepção</a>
<select name="dnn:ctr429:PlanoformEdit:lstExceptions" id="dnn_ctr429_PlanoformEdit_lstExceptions" class="NormalTextBox" style="width:100px;">
<option value="3">13-04-2006</option>
<option value="4">15-07-2007</option>
</select>
Everything works fine (the calendar popup opens, I select a date and it is added to the dropdownlist), except one thing: later on I must save data and, when I click the save button, my code behind sees no items in the combobox (Me.lstExceptions.Items.Count is 0)!!! This means that I'm changing the items on the client-side, but cannot syncronize the changes to the server side, failing to save the changes. I believe I'm close to the solution, but cannot figure it out!
Can you help me? Thanks a lot!
Ricardo Pinto.