简体   繁体   English

ASPxPopup在ASPxGridView选择更改时未更新

[英]ASPxPopup doesnt update on ASPxGridView Selection changed

I have an ASPxPopupControl and an ASPxGridView. 我有一个ASPxPopupControl和一个ASPxGridView。 Inside this PopupControl i have my own usercontrol which contains a form for editing person information. 在此PopupControl中,我有自己的usercontrol,其中包含用于编辑人员信息的表单。 Inside the GridView is a list with different persons. GridView内部是一个包含不同人员的列表。 When i select a different person in the gridview i want the content of the popupcontrol to update for the to the person information of the selected user so i can edit it. 当我在gridview中选择其他人时,我希望popupcontrol的内容更新为所选用户的人信息,以便我可以对其进行编辑。

My problem is; 我的问题是; i can't get this to work, i have tried placing update panels with all sorts of triggers or forcing the updatepanel to update. 我无法使它正常工作,我尝试放置带有各种触发器的更新面板或强制updatepanel进行更新。 But it still doesn't work. 但这仍然行不通。

PopupControl: PopupControl:

<dx:ASPxPopupControl ID="pcVolgnummerToevoegen" runat="server" AllowDragging="True" ClientInstanceName="popup_toevoegen" CloseAction="CloseButton" LoadingPanelText="Laden&amp;hellip;" Height="700" Width="700" Modal="True" PopupHorizontalAlign="WindowCenter" PopupVerticalAlign="WindowCenter">
<ContentCollection>
<dx:PopupControlContentControl ID="pcVolgnummerToevoegenContent" runat="server">
  <asp:UpdatePanel ID="upnlToevoegen" runat="server" UpdateMode="Conditional">
    <ContentTemplate>
      <uc:GegevensControl ID="ucGegevensControl_Toevoegen" runat="server" />
    </ContentTemplate>
    <Triggers>
      <asp:AsyncPostBackTrigger ControlID="KlantVolgnummerGrid" />
    </Triggers>
  </asp:UpdatePanel>
</dx:PopupControlContentControl>
</ContentCollection>
</dx:ASPxPopupControl>

DataView Selection_Changed: DataView Selection_Changed:

protected void KlantVolgnummerGrid_SelectionChanged(object sender, EventArgs e)
{
  Session["Person_Id"] = KlantVolgnummerGrid.GetSelectedFieldValues("ID");
}

Page_Load of the usercontrol inside the popup 弹出窗口中usercontrol的Page_Load

protected void Page_Load(object sender, EventArgs e)
{
 Person varPerson = PersonControllerClient.GetPerson(Session["Person_Id"]);
 ....Code that fills the form
}

I have checked the SelectionChanged event of the GridView, it triggers. 我已经检查了GridView的SelectionChanged事件,它会触发。 But the update panel doesn't update. 但是更新面板不会更新。 After i refresh the page the person i have selected is shown inside the popup. 刷新页面后,弹出窗口中将显示我选择的人。

Is there anyway i can update the popup for showing the right person without having to refresh the page everytime i select a different person? 无论如何,我是否可以更新弹出窗口以显示合适的人,而不必每次选择其他人时都刷新页面?

Disable a ASPxGridView callback mode to force grid using UpdatePanel callbacks. 禁用ASPxGridView回调模式以使用UpdatePanel回调强制网格。

Just set the ASPxGridView.EnableCallBack http://documentation.devexpress.com/#AspNet/DevExpressWebASPxGridViewASPxGridView_EnableCallBackstopic property to “false”. 只需将ASPxGridView.EnableCallBack http://documentation.devexpress.com/#AspNet/DevExpressWebASPxGridViewASPxGridView_EnableCallBackstopic属性设置为“ false”。

Remove the trigger and add ChildrenAsTriggers="false" on your updatepanel 删除触发器,并在您的updatepanel上添加ChildrenAsTriggers="false"

  <asp:UpdatePanel ID="upnlToevoegen" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false">
    <ContentTemplate>
      <uc:GegevensControl ID="ucGegevensControl_Toevoegen" runat="server" />
    </ContentTemplate>
  </asp:UpdatePanel>

code-behind: 后台代码:

protected void KlantVolgnummerGrid_SelectionChanged(object sender, EventArgs e)
{
  int id = KlantVolgnummerGrid.GetSelectedFieldValues("ID");
  Person varPerson = PersonControllerClient.GetPerson(id);
  ....Code that fills the form

  upnlToevoegen.Update();
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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