我有一个RadGrid打开一个PopUp窗口来更新记录。在编辑弹出窗口中,我有一个组合框,其中有选择索引更改事件。在那种情况下,我试图设置网格页面上的HiddenFields。这意味着隐藏的字段不在网格的同一范围内。
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>
代码隐藏
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
... }
答案 0 :(得分:0)
您正在SelectedIndexChanged事件上触发服务器端事件。这意味着您的弹出窗口将有关在组合框中选择的项目的信息发布到服务器。您希望数据在客户端的父浏览器窗口中的隐藏字段中显示。
要在客户端上更新该信息,您有两种选择: