2012-06-18 69 views
0

我在ASPX中使用EXT.NET。我以前從來沒有遇到過這個問題。當我有一個事件觸發器的頁面重新運行所有的代碼(儘管它實際上並沒有「重新加載」頁面)。據我所知,這在所有其他頁面上都沒有發生。示例代碼:ASPX在事件觸發器上重新運行整個頁面代碼

protected void gSelectApplied(object sender,EventArgs e) 
{ 
    Ext.Net.ComboBox box = (Ext.Net.ComboBox)sender; 
    string name = box.ID; 
    switch (name) 
    { 
     case "gPreviousApplied": 
      { 
       gPreviousAppliedfunded.Hidden = box.SelectedItem.Value.ToString() == "Yes" 
        ? false 
        : true; 
       break; 
      } 
     case "gPreviousAppliedfunded": 
      { 
       gPreviousApplied.Hidden = box.SelectedItem.Value.ToString() == "Yes" 
        ? false 
        : true; 
       break; 
      } 

    } 

} 

這會執行並且應該隱藏頁面上的元素。然而,這不會發生,因爲它將隱藏設置爲true(甚至不可見),然後重新恢復。當我在常規頁面中設置斷點時,它在觸發事件時觸發斷點,然後觸發事件代碼本身。

前端看起來這樣:

<ext:FormPanel ID="Sec5" runat="server" AutoHeight="true" BodyBorder="false" 
      Layout="FormLayout" LabelAlign="Right" LabelPad="25" LabelWidth="220" Cls="blue" 
      PaddingSummary="5px 0px 5px 115px" Border="false" BaseCls=".uData" Hidden="false"> 
      <Items> 
       <ext:ComboBox FieldLabel="someField" ID="gPreviousApplied" 
        runat="server" OnDirectSelect="gSelectApplied"> 
        <Items> 
         <ext:ListItem Text="Yes" /> 
         <ext:ListItem Text="No" /> 
        </Items> 
       </ext:ComboBox> 
       <ext:ComboBox FieldLabel="something" ID="gPreviousAppliedfunded" 
        runat="server"> 
        <Items> 
         <ext:ListItem Text="Yes" /> 
         <ext:ListItem Text="No" /> 
        </Items> 
       </ext:ComboBox> 
       <ext:ComboBox FieldLabel="somethingelse" ID="gPreviousApplied" 
        runat="server"> 
        <Items> 
         <ext:ListItem Text="Yes" /> 
         <ext:ListItem Text="No" /> 
        </Items> 
       </ext:ComboBox> 
      </Items> 
     </ext:FormPanel> 
    </Items> 
</ext:Panel> 
+0

而你的問題是....? – JohnFx

+1

你是什麼意思,它再次運行頁面上的所有代碼?它應該根據ASP.NET頁面生命週期運行頁面的所有代碼事件(init,load,pre render等)。它的行爲與此不同嗎? – bechbd

+0

做了這個事件使當前頁面的所有生命週期?如果它在那裏,則在Render上獲得斷點。如果不是問題導致回調不回發。 讓我們知道發生了什麼 – harry180

回答

0

請檢查autoeventwireup設置爲false在aspx頁面。 同時檢查page_load中是否有任何內容將元素設置爲false。 在page_load函數中使用page.ispostback

相關問題