简体   繁体   中英

RadGrid Edit Popup

I have a RadGrid that opens a PopUp window for updating records. In the edit popup I have a combobox where that has on selectedindex changed event. In that event I am trying to set HiddenFields that are on the page of the grid. Meaning that the hidden Fields are not in the same scope of the grid.

page.aspx

    <div>
                    <RadGrid runat="server" ID="GlJournalEntryGrid" Height="300px" Width="1400px"
                        AutoGenerateColumns="False" OnNeedDataSource="GlJournalEntryGrid_NeedDataSource"
                        OnItemCommand="GlJournalEntryGrid_ItemCommand"
                        OnItemDataBound="GlJournalEntryGrid_ItemDataBound">

... Edit PopUp and controls....the comboBox that updates one of the other HF below...

                    </RadGrid>
                </div>
                <div id="HiddenFieldsForGlChartLU">
                    <asp:HiddenField runat="server" ID="jegAccountHF" />
                    <asp:HiddenField runat="server" ID="jegCompanyHF" />
                    <asp:HiddenField runat="server" ID="jegDivisionHF" />
                    <asp:HiddenField runat="server" ID="jegRegionHF" />
                    <asp:HiddenField runat="server" ID="jegDepartmentHF" />
                </div>

code-Behind

    protected void jegCompany_ComboBox_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
    {            
        #region Set HiddenField for control so accessible by javascript

        if (cbCompany.SelectedValue != null)
            jegCompanyHF.Value = cbCompany.SelectedValue;
        else
            jegCompanyHF.Value = "";

        #endregion Set HiddenField for control so accessible by javascript

... }

You are triggering a server-side event on the SelectedIndexChanged event. This means your popup is posting the information about the item selected in the combobox to the server. You want the data to be presented in a hidden field in the parent browser window on the client.

In order to update that information on the client, you have two options:

  1. Write some Javascript from the child window to send the data to the parent window.
  2. In your SelectedIndexChanged event write the data to session and then trigger a refresh of the parent window to load the data from session

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM