Question

I'm using the Infragistics UltraWebGrid control and have the following layout:

<igtbl:UltraWebGrid ID="uwgPrescribedTrainingPlan" runat="server" Browser="Auto">
   <Bands>
      <igtbl:UltraGridBand DataKeyField="TRAININGPLANID">
         <Columns>
            ...
            <igtbl:UltraGridColumn HeaderText="Training Start Date" Key="STARTDATE" BaseColumnName="STARTDATE"
               DataType="System.DateTime" Format="MM-dd-yy" EditorControlID="wdcDateChooser" />
            <igtbl:UltraGridColumn HeaderText="Training End Date" Key="ENDDATE" BaseColumnName="ENDDATE"
               DataType="System.DateTime" Format="MM-dd-yy" EditorControlID="wdcDateChooser" />
            ...
         </Columns>
      </igtbl:UltraGridBand>
   </Bands>
</igtbl:UltraWebGrid>

The two important columns are STARTDATE and ENDDATE. Both allow users to edit the cell using a calendar control.

Right now, if you change the value of an ENDDATE cell, the picker will default to the current date. What I want is to default to the value of the STARTDATE column (if there is one).

I've looked around the docs and didn't find much, and the client side scripting API seems to be completely undocumented. Does anyone know if this is possible to do?

UPDATE:

I can attach a handler to the AfterDropDown event of wdcDateChooser, however in that handler I don't see any way to get the row I clicked on in the grid.

Was it helpful?

Solution

I believe I have a solution. I've attached the following Javascript to the AfterDropDown event of the WebDateChooser control like so:

<ClientSideEvents AfterDropDown="InitEndDateDefault"></ClientSideEvents>

The Javascript function is as follows:

function InitEndDateDefault(oDateChooser, dropDownPanel, oEvent)
{
   var cell = oDateChooser.webGrid.grid.getActiveCell();

   if (cell.Column.Key == "ENDDATE" && !oDateChooser.getValue())
   {
      var startDate = cell.getPrevCell().getValue();
      oDateChooser.Calendar.setSelectedDate(startDate);
   }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top