This is a migrated thread and some comments may be shown as answers.

Grid Details Popup: On Load Event

0 Answers 75 Views
Grid
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 1
David asked on 28 Mar 2012, 04:15 PM

In the popup that opens when I insert or edit one item in the grid, some logic has to be done, for example: enable and disable fields, depending on the values of other fields.

How can I add an onload event for the popup so that I can run js code to perform those enable/disable?

I already tried the OnPopUpShowing event, but it doesn’t work with date pickers, it fails in the get_selectedDate() because the _dateInput is empty (return this._dateInput.get_selectedDate())

Here’s the grid and javascript (simplified):

<RadGrid runat="server" ID="Grid1" AllowPaging="True" GridLines="None" CellSpacing="0" Culture="English (United Kingdom)" AllowSorting="True" AutoGenerateDeleteColumn="True" Width="95%" AllowAutomaticDeletes="True" AllowAutomaticInserts="True" AllowAutomaticUpdates="True" DataSourceID="ControlPanelNotifications_DS">

<MasterTableView DataKeyNames="fldId" DataSourceID="ControlPanelNotifications_DS" EditMode="PopUp" AutoGenerateColumns="False">

<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>

<RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>

<ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>

<Columns>

<ItemStyle HorizontalAlign="Center" Width="40px"></ItemStyle>

</sqr:GridButtonColumn>

</Columns>

<EditFormSettings CaptionFormatString="Detalhes" EditFormType="Template">

<EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>

<FormTemplate>

<table style="width: 100%;">

<tr>

    <td>

                label

    <td>

                text

    <td>

                Label2

    <td>

                <RadDatePicker runat="server" ID="dtPracticalDate" Width="100px">

          <ClientEvents OnDateSelected="dtPracticalDate_DateSelected" />

        </RadDatePicker >

                <BindableControl runat="server" DataField="PraticalDate" TargetControlID="dtPracticalDate"></BindableControl>&nbsp;</td>

</tr>

<tr>

    <td>

                Label3

    <td>

text

               

     

    </td>

    <td>

                Label4

    <td>

                <RadDatePicker runat="server" ID="dtConfirmationDate" Width="100px">

          <ClientEvents OnDateSelected="dtConfirmationDate_DateSelected" />

        </RadDatePicker >

                <BindableControl runat="server" DataField="ConfirmationDate" TargetControlID="dtConfirmationDate"></BindableControl>&nbsp;</td>

</tr>

</table>

 

<asp:Button runat="server" CommandName="Cancel" Text="Cancelar"></asp:Button>

 

</FormTemplate>

<PopUpSettings Modal="True" Width="570px"></PopUpSettings>

</EditFormSettings>

</MasterTableView>

<FilterMenu EnableImageSprites="False"></FilterMenu>

<ClientSettings>

<ClientEvents OnPopUpShowing="PopUpShowing"></ClientEvents>

</ClientSettings>

<HeaderContextMenu CssClass="GridContextMenu GridContextMenu_Default"></HeaderContextMenu>

</RadGrid>

Javascript:

function PopUpShowing(sender, eventArgs) {

    var practicalDate = getElementById('dtPracticalDate').get_selectedDate();

    UpdateConfirmationDate22(practicalDate);

}

function UpdateConfirmationDate22(practicalDate) {

    var confirmationDatePicker = getElementById('dtConfirmationDate');

    if (practicalDate != null) {

        confirmationDatePicker.set_enabled(true);

    }

    else {

        confirmationDatePicker.set_enabled(false);

        confirmationDatePicker.clear();

    }

}

No answers yet. Maybe you can help?

Tags
Grid
Asked by
David
Top achievements
Rank 1
Share this question
or