I've spent several hours troubleshooting a crazy bug, which is explained in detail here. In a nutshell, the changed state of toolbar buttons (ASP.Net LinkButton controls) was not being kept. Every time a partial postback occurred on the web page, the changes would disappear.
I did much research and learned that the IPostBackHandler mechanism is what was responsible for restoring the control values after each postback. For some reason it didn't appear to be working. I even built a small test project but it did work in that!
Suddenly I noticed that the test page in my main project had EnableViewState=false. I changed it to true and ... everything worked fine!
My findings seem to conflict with several articles, including this one. All I know is that in my case EnableViewState must be set to true.
I'm posting this, both as a future reminder to myself and in the hopes that a State Management guru will read it and explain to me what's really going on.
Tuesday, June 16, 2009
Thursday, June 11, 2009
pageLoad() and $(document).ready()
I just read a pair of articles by Dave Ward over at his excellent Encosia site. This one focuses on the differences between pageLoad() and $(document).ready() and this one focuses on having a pageLoad() function in both a Content page and a Master page.
If you're not 100% familiar about when these functions fire (and don't fire) then I'd strongly recommend reading both articles.
If you're not 100% familiar about when these functions fire (and don't fire) then I'd strongly recommend reading both articles.
Tuesday, June 9, 2009
Cacading Events in a Master-Content Page Project
I came across a situation where I needed to add a toolbar to a Master Page and monitor the toolbar button events from the Content Pages. I did a bunch of research and came across this article. It explains what one must do to accomplish this.
One key necessity is to add a directive similar to this on every content page:
<%@ MasterType VirtualPath="~/main.Master" %>
Then in the Master Page you have to define an event handler similar to this:
public event EventHandler CommandButton_ClickHandler;
When a button in the Master Page is pressed, you explicitly fire the event like this:
protected void CommandButton_Click(object sender, EventArgs e)
{
CommandButton_ClickHandler(sender, e);
}
Finally, in every content page you have to wire up the event handler mechanism:
protected void Page_Init(object sender, EventArgs e)
{
Master.Toolbar_ClickHandler += new EventHandler(CommandButton_Click);
}
Whenever a button in the Master Page is pressed, it causes the event handler you setup to fire, which in turn is monitored by the listener in the content page. It's all quite simple but you have to get the syntax just right.
I created a small proof of concept project, which includes buttons directly located in a Master Page, as well as another example of buttons in a toolbar, which in turn sits in a Master Page. You can download this project here. For the first approach, set "default.aspx" as the start page. For the second approach, use "default2.aspx" instead. Hopefully this will help you implement this powerful concept in your own work!
One key necessity is to add a directive similar to this on every content page:
<%@ MasterType VirtualPath="~/main.Master" %>
Then in the Master Page you have to define an event handler similar to this:
public event EventHandler CommandButton_ClickHandler;
When a button in the Master Page is pressed, you explicitly fire the event like this:
protected void CommandButton_Click(object sender, EventArgs e)
{
CommandButton_ClickHandler(sender, e);
}
Finally, in every content page you have to wire up the event handler mechanism:
protected void Page_Init(object sender, EventArgs e)
{
Master.Toolbar_ClickHandler += new EventHandler(CommandButton_Click);
}
Whenever a button in the Master Page is pressed, it causes the event handler you setup to fire, which in turn is monitored by the listener in the content page. It's all quite simple but you have to get the syntax just right.
I created a small proof of concept project, which includes buttons directly located in a Master Page, as well as another example of buttons in a toolbar, which in turn sits in a Master Page. You can download this project here. For the first approach, set "default.aspx" as the start page. For the second approach, use "default2.aspx" instead. Hopefully this will help you implement this powerful concept in your own work!
Sunday, June 7, 2009
Review: Windows 7 - 64 bit Release Candidate
For those seeking unbiased independent feedback on the upcoming Windows 7, these comments are not mine but come from a tech savvy friend/colleague:
Windows 7 RC 64-bit – Notes:
- One thing I noticed right off the hop was that it went out and automatically went looking for drivers for the hardware in my laptop. It must have reported my configuration back to Microsoft and then automatically downloaded whatever it had been able to identify. I have not done much with it yet, but I can see that it is more responsive. Total memory load after initial boot (with nothing else installed on the system) is 16 % of 4094 (4 GB total RAM) or approx. 650 MB, this compares with about 900 MB on my Vista system (same platform).
- Memory footprint is now sitting at 1 GB just about all the time, surprisingly it remains quite responsive but don't even think of running this on less than a dual-core.
- There is no email client installed by default, you can go to the MS site and download live mail. They cut out a bunch of "default" applications (messenger etc. – although I don’t use it anyway).
- It now includes a screen capture tool, obviously not as full featured as SnagIt but still functional.
- The Windows side bar from Vista and any screen gadgets are not loaded at startup by default, although if you get a system from Dell or HP I imagine that they will add their own tweaks to the interface.
- They are trying to make the computer even easier to use in the future (people will not have a clue how to do anything). I suppose many people just want that to be the way their computer works (just make it work and I don't give a S**T what goes on underneath). This was clearly evidenced by the fact that it went out looking for drivers for my system without my intervention. I suppose a Mac works the same way, how many people know that Unix is sitting under the hood, not your average user anyway.
- Everything looks very like Vista. Taskbar is different and you can pin shortcuts to it. They have added a glow effect when you mouse over.
- File copying still is not as fast as XP, but improved from Vista.
- Boot time is quicker than my XP desktop and recovery from sleep is VERY quick.
- Installed 32-bit Adobe Photoshop and LightRoom - no problem.
- Installed 64-bit Java but Adobe Flash is not available in 64-bit yet, so you need to run two different browsers to get full functionality (Youtube and Java sites).
- After system boot RAM is at 837 MB and the system is usable, although there is still stuff going on in the background and if you let the system settle down for a few minutes the RAM is then at 971 MB.
- Ran a virus scan (Avira - free) on schedule, but the memory consumed by the application did not release after the scan was complete (then at 1225 MB).
- Installed Firefox – no problems.
- If you want to install the applications that MS cut from the install (mail client, messenger etc) then you have to install "Live Essentials". If you select everything this loads a HUGE suite of applications, you can be selective, but I went to see what it wanted to load with just the mail client and it was more than I wanted on the system. I think in such cases it would be better to load individual "other" applications to fill the gap (Thunderbird, Picasa etc.). Although I think it would depend on the user that I was doing this for.
- I was looking at pricing today as the download from MS is Windows 7 Ultimate version. There is no pricing announced, but Vista Ultimate was selling for $591......wow !! I could not see paying anything even close to that for an operating system and it "aint that good".....at least not $600 worth of good.
- General observation on installing software - there is a very definite pause before anything starts to happen, in fact you might even think that things had froze. The user account control is way less annoying (I guess they must have listened there also), but still pops up if there are changes going to happen to the system (like installing software). I tried installing SnagIt, but when it got to installing the printer driver the whole process got stuck consuming 50 % of the CPU and I had to kill everything and reboot to finally clear it.
- By the way I have not tweaked this installation at all and everything that was "running out of the box" is still running (like indexing, defender etc.). I decided to leave it as is and just see how it performs. So far it seems to do quite well, despite the huge amount of RAM that it is consuming. I see several comments on the web about people calling this "what Vista was supposed to be". Vista never should have shipped.
- Windows 7 is looking like a definite improvement on Vista. Today there was a flag in the notification area that wanted me to setup a backup. I decided to play along and it walked me through choosing a destination. It gives all sorts of hints and links to get more information. Once I had chosen a backup location (my FreeNAS backup server) it looked at it and said that it was visible to other users and was this okay. We proceeded and I let it go with whatever defaults it wanted to save, which included making a full disc image as well as saving all of my documents and settings. It then prompted and said to access the disc image you would have to create a rescue cd or dvd, I clicked that link and it walked me through the process of making a rescue disc.
- When you look at these things that they have thrown in, such as: screen capture, decent backup utility, screen notes etc......plus whatever I have not come across yet, it looks like maybe they are starting to get the right idea (after how many years......). I suppose I should try and find a feature list somewhere so I can take full advantage of this "test drive".
- Had a spare 2 GB high speed SD card so I decided to add that to the system and let it use it as “Ready Boost”. Things seem to be snappier, but I am not sure if that is real or imagined. My system is quick and does have good specs. (Core 2 Duo 2.1 GHZ with 4 GB RAM). I will leave it in for a few days and then remove it and see if I notice any change.
- Could not install Zonealarm Security Suite – not ready for Windows 7 yet.
- Regular virus scan just started and the system is now consuming approx. 1750 MB RAM. Max RAM consumed during this process was as high as 1975 MB – ouch !! Scan completed and it failed to release the RAM again – now sitting at 1941 MB – obviously a reboot will fix that, but that is not right. Seeing as other applications do not do this it has to be the Avira anti-virus that is causing this.
- I did have one unidentified item in Device Manager, this is now resolved (but not by me). I have to assume that one of the updates from MS fixed this.
- Not all of the themes are enabled but can be added. There are different themes for different countries (US, Cdn, South Africa, Aus, UK) – I like the Cdn. theme.
Windows 7 RC 64-bit – Notes:
- One thing I noticed right off the hop was that it went out and automatically went looking for drivers for the hardware in my laptop. It must have reported my configuration back to Microsoft and then automatically downloaded whatever it had been able to identify. I have not done much with it yet, but I can see that it is more responsive. Total memory load after initial boot (with nothing else installed on the system) is 16 % of 4094 (4 GB total RAM) or approx. 650 MB, this compares with about 900 MB on my Vista system (same platform).
- Memory footprint is now sitting at 1 GB just about all the time, surprisingly it remains quite responsive but don't even think of running this on less than a dual-core.
- There is no email client installed by default, you can go to the MS site and download live mail. They cut out a bunch of "default" applications (messenger etc. – although I don’t use it anyway).
- It now includes a screen capture tool, obviously not as full featured as SnagIt but still functional.
- The Windows side bar from Vista and any screen gadgets are not loaded at startup by default, although if you get a system from Dell or HP I imagine that they will add their own tweaks to the interface.
- They are trying to make the computer even easier to use in the future (people will not have a clue how to do anything). I suppose many people just want that to be the way their computer works (just make it work and I don't give a S**T what goes on underneath). This was clearly evidenced by the fact that it went out looking for drivers for my system without my intervention. I suppose a Mac works the same way, how many people know that Unix is sitting under the hood, not your average user anyway.
- Everything looks very like Vista. Taskbar is different and you can pin shortcuts to it. They have added a glow effect when you mouse over.
- File copying still is not as fast as XP, but improved from Vista.
- Boot time is quicker than my XP desktop and recovery from sleep is VERY quick.
- Installed 32-bit Adobe Photoshop and LightRoom - no problem.
- Installed 64-bit Java but Adobe Flash is not available in 64-bit yet, so you need to run two different browsers to get full functionality (Youtube and Java sites).
- After system boot RAM is at 837 MB and the system is usable, although there is still stuff going on in the background and if you let the system settle down for a few minutes the RAM is then at 971 MB.
- Ran a virus scan (Avira - free) on schedule, but the memory consumed by the application did not release after the scan was complete (then at 1225 MB).
- Installed Firefox – no problems.
- If you want to install the applications that MS cut from the install (mail client, messenger etc) then you have to install "Live Essentials". If you select everything this loads a HUGE suite of applications, you can be selective, but I went to see what it wanted to load with just the mail client and it was more than I wanted on the system. I think in such cases it would be better to load individual "other" applications to fill the gap (Thunderbird, Picasa etc.). Although I think it would depend on the user that I was doing this for.
- I was looking at pricing today as the download from MS is Windows 7 Ultimate version. There is no pricing announced, but Vista Ultimate was selling for $591......wow !! I could not see paying anything even close to that for an operating system and it "aint that good".....at least not $600 worth of good.
- General observation on installing software - there is a very definite pause before anything starts to happen, in fact you might even think that things had froze. The user account control is way less annoying (I guess they must have listened there also), but still pops up if there are changes going to happen to the system (like installing software). I tried installing SnagIt, but when it got to installing the printer driver the whole process got stuck consuming 50 % of the CPU and I had to kill everything and reboot to finally clear it.
- By the way I have not tweaked this installation at all and everything that was "running out of the box" is still running (like indexing, defender etc.). I decided to leave it as is and just see how it performs. So far it seems to do quite well, despite the huge amount of RAM that it is consuming. I see several comments on the web about people calling this "what Vista was supposed to be". Vista never should have shipped.
- Windows 7 is looking like a definite improvement on Vista. Today there was a flag in the notification area that wanted me to setup a backup. I decided to play along and it walked me through choosing a destination. It gives all sorts of hints and links to get more information. Once I had chosen a backup location (my FreeNAS backup server) it looked at it and said that it was visible to other users and was this okay. We proceeded and I let it go with whatever defaults it wanted to save, which included making a full disc image as well as saving all of my documents and settings. It then prompted and said to access the disc image you would have to create a rescue cd or dvd, I clicked that link and it walked me through the process of making a rescue disc.
- When you look at these things that they have thrown in, such as: screen capture, decent backup utility, screen notes etc......plus whatever I have not come across yet, it looks like maybe they are starting to get the right idea (after how many years......). I suppose I should try and find a feature list somewhere so I can take full advantage of this "test drive".
- Had a spare 2 GB high speed SD card so I decided to add that to the system and let it use it as “Ready Boost”. Things seem to be snappier, but I am not sure if that is real or imagined. My system is quick and does have good specs. (Core 2 Duo 2.1 GHZ with 4 GB RAM). I will leave it in for a few days and then remove it and see if I notice any change.
- Could not install Zonealarm Security Suite – not ready for Windows 7 yet.
- Regular virus scan just started and the system is now consuming approx. 1750 MB RAM. Max RAM consumed during this process was as high as 1975 MB – ouch !! Scan completed and it failed to release the RAM again – now sitting at 1941 MB – obviously a reboot will fix that, but that is not right. Seeing as other applications do not do this it has to be the Avira anti-virus that is causing this.
- I did have one unidentified item in Device Manager, this is now resolved (but not by me). I have to assume that one of the updates from MS fixed this.
- Not all of the themes are enabled but can be added. There are different themes for different countries (US, Cdn, South Africa, Aus, UK) – I like the Cdn. theme.
Wednesday, June 3, 2009
ThickBox Demo Project
As a follow-up to my recent postings about ThickBox, I've created a demonstration page, which succinctly summarizes my work on ThickBox to date. It also provides some improvements over what I've written previously. Plus, you're able to download all of the code as well, which should especially help people learning jQuery and ThickBox anew.
Subscribe to:
Posts (Atom)