2012-08-13 59 views
0

我的更新潘内尔不更新,当我在我的代码隐藏文件中使用UpDetail.update()我的UpdatePanel不更新。当我使用Update方法

<asp:UpdatePanel ID="UpDetail" runat="server" RenderMode="Inline" UpdateMode="Conditional"> 
     <ContentTemplate> 
      <asp:Label ID="AAAA" runat="server"> LOL </asp:Label> 
      <asp:Label ID="Label1" runat="server"> <%= DateTime.Now.ToString() %> </asp:Label> 
     </ContentTemplate> 
    </asp:UpdatePanel> 

在我的CS文件:

protected void GvGestionnaires_SelectionChanged(object sender, EventArgs e) 
    { 

       AAAA.Text = "TOTO"; 
       UpDetail.Update(); 
    } 

我的事件GvGestionnaires_SelectionChanged是工作,但我的面板没有刷新,为什么呢?

编辑:

我已经尝试使用一个按钮,而不是我的DX:GridView和它的工作。为什么? ! :○ - user1594914刚才编辑

解决:

添加EnableCallBacks = “假” 给我的DX:gridview的

<dx:ASPxGridView runat="server" ID="GvGestionnaires" KeyFieldName="id" DataSourceID="LinqDataSource" EnableCallBacks="False" 
    OnSelectionChanged="GvGestionnaires_SelectionChanged" 
    OnPageIndexChanged="GvGestionnaires_PageIndexChanged"> 
+0

尝试将“LOL”作为值添加到“文本”属性 – 2012-08-13 09:35:32

+0

我已经这么做了,但它不能解决我的问题。 – user1594914 2012-08-13 09:39:15

+0

用新建议更新了我的回答。 – bUKaneer 2012-08-13 10:18:16

回答

0

尝试将触发添加到您的更新面板:

<asp:UpdatePanel ID="UpDetail" runat="server" RenderMode="Inline" UpdateMode="Conditional"> 
    <ContentTemplate> 
     <asp:Label ID="AAAA" runat="server"> LOL </asp:Label> 
     <asp:Label ID="Label1" runat="server"> <%= DateTime.Now.ToString() %> </asp:Label> 
    </ContentTemplate> 
    <Triggers> 
     <asp:AsyncPostBackTrigger ControlID="GvGestionnaires" EventName="SelectionChanged" /> 
    </Triggers> 
</asp:UpdatePanel>  
+0

感谢您的回复,但它也不能解决我的问题。我的gridview是dx:ASPxGridView(developper express) – user1594914 2012-08-13 09:53:38

0

尝试添加ChildrenAsTriggers =“false”属性并重新测试:

<asp:UpdatePanel ChildrenAsTriggers="false" ID="UpDetail" runat="server" RenderMode="Inline" UpdateMode="Conditional"> 
     <ContentTemplate> 
      <asp:Label ID="AAAA" runat="server"> LOL </asp:Label> 
      <asp:Label ID="Label1" runat="server"> <%= DateTime.Now.ToString() %> </asp:Label> 
     </ContentTemplate> 
    </asp:UpdatePanel> 

在这篇文章中http://msdn.microsoft.com/en-us/library/system.web.ui.updatepanel.update.aspx .Update()被调用之前尝试设置值尝试在你的周围的.cs交换你的代码文件是这样的:

protected void GvGestionnaires_SelectionChanged(object sender, EventArgs e) 
    { 
       UpDetail.Update(); 
       AAAA.Text = "TOTO"; 

    } 
+0

嗨,它不能解决我的问题 – user1594914 2012-08-13 10:01:42

0

放的UpdateMode =“条件”属性里面< ASP:的UpdatePanel>

0

LOL <%= DateTime.Now.ToString()%>

相关问题