Showing posts with label elements. Show all posts
Showing posts with label elements. Show all posts

Monday, March 26, 2012

MutuallyExclusiveCheckBoxExtender doesnt work if elements are added dynamically

I create my table on the fly and added checkboxes as well as MECBextenders.

The client script is not working on the page. It works as expected if the MECBs are added during design time.

Here is some code to demonstrate population:

1string extenderKey ="AllTheSameKey";23foreach (MvpPoint pointin _selected.FolderPoints)4 {5678switch (point.PointType)9 {10case tPointType.DO:11case tPointType.CP:12 {13continue;14 }15default:16 {17 trow =new TableRow();1819 CheckBox chkSelected =new CheckBox();20string sPointId = point.Handle.ToString();21 chkSelected.ID ="chk" + sPointId;22 chkSelected.Visible =true;23if (point.PointType == tPointType.AI)24 chkSelected.Enabled =true;25else26 chkSelected.Enabled =true;2728 AjaxControlToolkit.MutuallyExclusiveCheckBoxExtender chkExtender =new AjaxControlToolkit.MutuallyExclusiveCheckBoxExtender();29 chkExtender.ID ="chkExt" + sPointId;30 chkExtender.TargetControlID = chkSelected.ID;31 chkExtender.Key = extenderKey;32

The problem ONLY exists if the MutuallyExclusiveCheckBoxExtender is cointeined inside a TabPanel. The IDs get changed by the cointeiner control and the jscript fails to find them.

Saturday, March 24, 2012

Navigation best practices

I'm writing a ASP.NET web application that uses Ajax. The application has an "outlook-like" layout with navigation elements (bars, tree) on the left and a menu on the top. The layout is implemented in a masterpage. There is a mix of both <a href> (get) and linkbutton controls (postback with response.redirect) that causes navigation to other page.

I'm using ajax on single pages to handle refresh-less updates, but I really want to change this application so that clicking on a link or linkbutton does not re-load the whole page (treeview, menu etc), but only updates the content part of the masterpage. The only option I know is reverting to good old <frames> but I hate frames. Is there anyway I cat use Ajax to handle cross page navigation correctly?

Hi Paala,

Do i understand you correctly that you want the navigation links to use Ajax so that your page is update with other content. If this is what you want to achieve it isn't possible with AJAX.. The links you are clicking on right now point to content pages (which inherit from the masterpage). These pages are totally new pages Ajax is a way to partial refresh parts of pages not to totally load new pages. (a masterpage will never be requested by an end-user, the content pages are requested by end-users)

The only solution you can use is to put al your content on one page and use the multi-view control and switch between the view when a user clicks on a link. This solution is very ugly because you have all your content on one page. Hope this helps

Regards,


Yes, that is the effect I was after. If I still reject using frames one method I've found is to convert all my content aspx files into web user controls (ascx) and use a placeholder inside a updatepanel on the "main page". All links will cause one or more controls to be loaded dynamically and the updatepanel causes the new content to be displayed. Since my pages does not only include text content, but are "applications" with post-back controls I will need to "reload" the controls on each postback so that viewstate and events still work.

Re-loading the controls does seam feasable, but I'm unsure about the performance. Anyone tried such an approach?