Monday, April 13, 2009

Controls Within UpdatePanel Causing Full Postback

So today I was wrapping up a little project I've been working on. As one of my final steps I was going through the app and wrapping ASP UpdatePanels around the parts of my pages that I didn't want to perform full postbacks. This was going just swimmingly until I hit one page where the UpdatePanel just didn't seem to want to work. It didn't cause any errors or anything but when I clicked on controls within the panel the page did a full postback every time. Did some searching on the web and found that one likely culprit for this symptom is a dyncamically created LinkButton with no ID. Such a beast would likely be found within a data bound control for instance. But in this case, although I certainly was using a LinkButton it clearly had an ID assigned to it already. So it didn't seem like that was my problem. Finally through Google I found an old page at MSDN blogs that looked like it might contain information of worth but MSDN blogs is a shit site and was down for a change. Luckily, the GOOG's cache saved the day. The cached version of the page can be found here (at least as I type this it can): The cached article What I found within that article is that for some reason if an UpdatePanel is the direct child of a table row element then it just doesn't work. And sure enough my code looked like this:
<asp:UpdatePanel ID="TagsUPNL" runat="server">
 <ContentTemplate>
  <tr>

   <td style="vertical-align: top;" class="LeftAlign">
      <asp:LinkButton ID="myLB" runat="server" Text="some text" OnClick="MyLB_Click" />

   </td>
   <td style="vertical-align: top;">
    Control to update ... 
   </td>
  </tr>

 </ContentTemplate>
</asp:UpdatePanel>







What I intended with the above was that the entire contents of the table row (both tds in other words) would be included in the partial post-back. But due to this odd detail of the UpdatePanel's implementation this is not a valid way to achieve this. The fix was to use two UpdatePanels and a trigger, like so:
<tr>
 <td style="vertical-align: top;" class="LeftAlign">
  <asp:UpdatePanel ID="TagsUPNL" runat="server">

   <ContentTemplate>
    <asp:LinkButton ID="AddTagLBTN" runat="server" Text="Add Tag" OnClick="AddTagLBTN_Click" />

   </ContentTemplate>
  </asp:UpdatePanel>
 </td>
 <td style="vertical-align: top;">

  <asp:UpdatePanel ID="TagsUPNL2" runat="server">
   <Triggers>
    <asp:AsyncPostBackTrigger ControlID="AddTagLBTN" EventName="Click" />

   </Triggers>
   <ContentTemplate>
    
   </ContentTemplate>
  </asp:UpdatePanel>
 </td>

</tr>




And that worked!

44 comments:

希望 said...

巨乳6k聊天室美女遊戲成人電影yoyo免費視訊性交圖片0204下載成人免費色情遊戲夫妻3p裸體寫真一夜情留言版偷拍網女優一露點走光寶貝圖貼片比基尼美白番薯籐交友合成貼圖完美女人視訊天心寫真集比基尼泳裝美女的影片人狗性交武林無碼免費亂倫小說小嫻走光新竹聊天室寫真集影片網愛聊天室免費寫真女郎影片情色典獄長台灣女優美夢俱樂部台灣色情網線上免費色情影片愛愛影片阿性情趣用品 真人情趣娃娃www tw2sex comut聊天室90691自拍走光貼圖近親相姦色情視訊無碼vcd自拍老婆俱樂部大奶媽色情百分百favebook18禁小遊戲一葉情情色貼圖區自拍偷拍

心跳 said...

目標是什麼不重要,目標能產生什麼樣的效果才重要..............................

餐廳 said...

友情像一棵樹木,要慢慢的栽培,才能成長真的友誼,要經過困難考驗,才可友誼永固........................................

驚訝 said...

a漫a片a圖一夜情一葉情人妻激情情色寫真美女自拍辣妹自拍正妹自拍美女走光辣妹走光正妹走光脫衣秀脫衣走光色情自慰自拍成人全裸打炮打手槍打飛機巨乳巨奶女優大奶性交性愛淫蕩淫慾淫亂淫婦

婉亞 said...

與其爭取不可能得到的東西,不如善自珍惜運用自己所擁有的........................................

郭美娟 said...

若對自己誠實,日積月累,就無法對別人不忠了。........................................

夏文宏 said...

弱者等待時機,強者製造時機........................................

政倫政倫 said...

以簡單的行為愉悅他人的心靈,勝過千人低頭禱告。........................................

GeraldF_Rotter雅慧 said...

Nice Post~!!!. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

冠伶 said...

Cool blog網愛聊天室色情網站交友找啦咧免費影片成人笑話成人圖庫sexy女同志聊天室愛戀情人用品情趣爽翻天咆哮小老鼠入口85cc6k脫衣人妻sexy85c脫光光taiwansex淫女情色成人男女做愛美女做愛脫衣秀a片正妹淫蕩色情後宮040185c85c77p2p77p2p性幻想手淫18禁

原秋 said...

很喜歡你的blog哦...加油唷 ........................................

淑婷RubinB said...

若對自己誠實,日積月累,就無法對別人不忠了。........................................

韋于倫成 said...

色情qvod色情視訊電話色情美眉寫真色情片免色情區咪咪情色區哈比成人網金瓶成人影片交流區金平梅近親相姦免費影片松島楓看波波貼圖區波波線上美女拳波波線上遊網波波線上戲網波霸美女貼圖區玩女人視訊網玩女人試看片玩女人影片直播色情片直播免費影片芭比成人情色花王影片哈比淫色網哈免費小遊戲洪爺色情免費影片洪爺色情網站影片洪爺色論壇洪爺免費直播片洪爺動畫色咪咪影片網一夜情聊天室聊天室正妹牆

志文 said...

用行動來支持你~~~不留言不行!........................................

呈均 said...

幸福不是一切,人還有責任。..................................................

07_TeddyF_Silvey0 said...

在莫非定律中有項笨蛋定律:「一個組織中的笨蛋,恆大於等於三分之二。」...........................................................................

AlysiaDraeger0417永瑞 said...

聰明的人喜歡猜心 雖然每次都猜對了卻失去了自己的心..................................................

聖妃 said...

任何你憂慮的事,你都應該去採取一點行動,不要只是在那邊想 ..................................................

智宜 said...

Where did you purchase this product?.............................................................

彥霖 said...

期待你的下次更新喔^____^.....................................................................

張怡 said...

在莫非定律中有項笨蛋定律:「一個組織中的笨蛋,恆大於等於三分之二。」....................................................................

asdas said...

成熟,就是有能力適應生活中的模糊。.................................................................

啟均 said...

向著星球長驅直進的人,反比踟躕在峽路上的人,更容易達到目的。............................................................

芸茂芸茂 said...

人生之中,比冒險更危險的一件事:不去冒險。..................................................

貞合 said...

hi!~~leave you a message to say hello, and thanks for your share!..................................................................

懿綺懿綺 said...

Prevention is better than cure.............................................................

江冠彭珮李佳宏陽筠 said...

晚上好,很喜歡你的blog哦...............................................................

洪淑桓洪淑桓 said...

相逢即是有緣~~留個言問候一聲,祝您平安順利............................................................

玉苓玉苓 said...

天道酬勤,blog也是!相信你的用心會讓你更受歡迎的............................................................

ju吳phe宇te佳ns said...

與人相處不妨多用眼睛說話,多用嘴巴思考. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

琬安琬安 said...

你不能改變容貌~~但你可以展現笑容.................................................................

思恬 said...

Poverty tries friends.............................................................

KevenR_Harrah1022 said...

faith will move mountains. ..................................................

吳婷婷 said...

所有的資產,在不被諒解時,都成了負債.................................................................

翔馨陳陳翔馨陳陳 said...

你不能決定生命的長度,但你可以控制它的寬度..................................................................

亦奈美妮 said...

一棵樹除非在春天開了花,否則難望在秋天結果。............................................................

周志v豪 said...

與人相處不妨多用眼睛說話,多用嘴巴思考,............................................................

偉曹琬 said...

一個人的價值,應該看他貢獻了什麼,而不是他取得了什麼....................................................

偉曹琬 said...

善言能贏得聽眾,善聽才能贏得朋友。......................................................................

峻胡邦慧v帆 said...

I do like ur article~!!!............................................................

佳張張張張燕張張張張張 said...

生存乃是不斷地在內心與靈魂交戰;寫作是坐著審判自己。............................................................

佳張張張張燕張張張張張 said...

培養健全孩子最好的方法是父母先成為健全的人。......................................................................

張佳穎 said...

看著你的BLOG 好多朋友都回應 真厲害..................................................

千TatianaCallan惠 said...

感動 + 感恩 + 感謝(。-ˍ-。 )............................................................