|
||||||
A Tale of Tabbed Pages![]() The Design: In my ASP.NET content management system, I wanted to use a tab control to allow an author to edit individual pages of an article. I also decided to use ActiveUp's HtmlTextBox control to enable rich-text editing: it's a full-featured control at a very reasonable price. The Problem: I quickly discovered, however, that changes to the text box weren't being saved when I switched to a different tab. After another marathon session of cursing and semi-random code-tweaking (I tried changing viewstate settings, attaching code to various page and control events, etc.), I finally concluded that the postback triggered by a change of tabs was circumventing the text box's onblur event, which is where it persists its contents. (I should mention that in my desperation, I took advantage of ActiveUp's live chat tech support feature. Pierre, the control's author, was extremely cordial and helpful. Since he's in Belgium and I tend to work in the middle of the night, the arrangement proved to be convenient for both of us!) The Solution: Now that I understood the source of the problem, the question was: How do I force the text box to persist its data before a postback? I tried a few things, and eventually found a solution by Googling for "intercept __doPostBack": The trick was to create my own function that does whatever I need to do before a postback, and then create a function pointer that redirects the default __doPostBack function to my custom function (JavaScript is awesome, by the way). Problem solved! Footnote: Another problem I had with the HtmlTextBox was that I couldn't get a second control on the page to work correctly. Pierre assured me that this is supported, so I took a closer look at my code. Turns out that the ID I was assigning to the second control contained a space (I create the controls dynamically based on an XML form definition -- that's a subject for another article -- and I was assigning an ID equal to the name of the data field). Replacing the space with an underscore solved that problem. Comments
Post a comment
|
Articles
Easy RSS in VB.NETIs Inheritance Overrated? A Tale of Tabbed Pages Categories
.NETBlog Career Cycling Geek Humor Microsoft Music Personal Rants Reading Software Tech Usability VB Archives
March 2008December 2006 August 2006 April 2006 February 2006 January 2006 December 2005 September 2005 June 2005 May 2005 March 2005 January 2005 December 2004 September 2004 July 2004 June 2004 January 2004 August 2003 July 2003 May 2003 April 2003 March 2003 February 2003 January 2003 December 2002 November 2002 Misc
Talk to MeSubscribe |
|||||
Will you be posting your tab based interface code in your site?
What tab control are you using?
Dave: I'm using Microsoft's Tabstrip Web control. There's a link to it in the opening paragraph of the article: click on the words "tab control."
Yaheya: The code belongs to my employer, so I can't post it here. I will, however, be discussing the content management system at the VSLive! conference in San Francisco next February; attendees will receive a copy of the source code.
If you're not able to attend the conference, or you're just interested in how to use Microsoft's Tabstrip control, you can find examples on Microsoft's MSDN site: simply click the words "tab control" in the opening paragraph of the article. Thanks!