{"id":10,"date":"2008-02-28T02:44:42","date_gmt":"2008-02-28T02:44:42","guid":{"rendered":"http:\/\/jcrawfor74.wordpress.com\/?p=7"},"modified":"2013-01-24T02:17:02","modified_gmt":"2013-01-23T15:17:02","slug":"ajax-popupcontrol-extender-and-dynamic-controls","status":"publish","type":"post","link":"https:\/\/ntsblog.homedev.com.au\/index.php\/2008\/02\/28\/ajax-popupcontrol-extender-and-dynamic-controls\/","title":{"rendered":"AJAX PopupControlExtender and Dynamic Controls"},"content":{"rendered":"<div id=\"ntsbl-2385523292\" class=\"ntsbl-before-content ntsbl-entity-placement\"><script async src=\"\/\/pagead2.googlesyndication.com\/pagead\/js\/adsbygoogle.js?client=ca-pub-6288941070289539\" crossorigin=\"anonymous\"><\/script><ins class=\"adsbygoogle\" style=\"display:inline-block;width:728px;height:90px;\" \ndata-ad-client=\"ca-pub-6288941070289539\" \ndata-ad-slot=\"9356781486\"><\/ins> \n<script> \n(adsbygoogle = window.adsbygoogle || []).push({}); \n<\/script>\n<\/div><p>I was attempting to use the PopupControl Extender the other day, to create myself a web user control for colour selection.<\/p>\n<p>Here is what I ended up creating..<br \/>\n<img decoding=\"async\" src=\"https:\/\/ntsblog.homedev.com.au\/wp-content\/uploads\/2008\/02\/2008-02-28_101030.png\" alt=\"Figure 1\"><\/p>\n<p>The problem I had was that the colour palette panel is being created dynamically. In this example it is a 25&#215;16 matrix made up of 375 dynamically created link buttons with their backcolour set to the colour from the palette. (Note: Used a link button due to postback.Asynch javascript errors that occur with PopupControl Extender in a modal dialog box as documented elsewhere on the web).<\/p>\n<p>When a user clicked on one of the link buttons it performed a postback, problem was it was doing a full postback and closing the popup window.<\/p>\n<p>Solution: When creating your controls dynamically to exist in your panel to be displayed by the popup extender you need to register them with the UpdatePanel triggers collection like so:<br \/>\n[csharp]<br \/>\nLinkButton btnColour = new LinkButton();<br \/>\n&#8230; setup you link button<br \/>\nbtnColour.ID = colurHexCode; \/\/ colurHexCode string variable containing the current colour I am setting as the backgroud<br \/>\nAsyncPostBackTrigger trigger = new AsyncPostBackTrigger();<br \/>\ntrigger.ControlID = btnColour.ID;<br \/>\nUpdatePanel1.Triggers.Add(trigger);<br \/>\n[\/csharp]<\/p>\n<p>This forces the dynamic control to be included in the update panel and when clicked only performs a partial update panel postback.<\/p>\n<p>Sweet<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was attempting to use the PopupControl Extender the other day, to create myself a web user control for colour selection. Here is what I [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[3,4],"tags":[],"class_list":["post-10","post","type-post","status-publish","format-standard","hentry","category-ajax","category-asp-net"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/posts\/10","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/comments?post=10"}],"version-history":[{"count":0,"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/posts\/10\/revisions"}],"wp:attachment":[{"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/media?parent=10"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/categories?post=10"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ntsblog.homedev.com.au\/index.php\/wp-json\/wp\/v2\/tags?post=10"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}