RSS 2.0  Frustrated by Design
# Monday, April 21, 2008

Adv AJAX Server Controls

I frequently am asked to server as a technical reviewer on development books. Time doesn't permit me to always say yes but I try to make time to agree to do the more interesting titles.

This book is one I said yes to. Adam and Joel have done a great job of exposing this detailed subject.

Controls are such a powerful re-use mechanism and so under covered.

The book is due for release on July 15th and you can save 5% with an Amazon.com preorder.

[ Click HERE for the book on Amazon.com ]

Monday, April 21, 2008 2:09:26 PM (Atlantic Standard Time, UTC-04:00)  #    Comments [0] - Trackback
AJAX | ASP.NET | Misfit Geek [Syndicated]
# Saturday, April 19, 2008

Does your client code need to know what control caused your update panels to update or which of several UpdatePanels contained the triggering control ? Try this.... (Or do the same thing with addbeginRequest();

    1 <script type="text/javascript">
    2 <!--
    3 var prm = Sys.WebForms.PageRequestManager.getInstance();
    4 
    5 prm.add_endRequest(EndRequest);
    7 function EndRequest(sender,args)
    8     {
    9     alert(sender._postBackSettings.panelID + " -> " + sender._postBackSettings.sourceElement.id);
   10     }
   11  -->
   12 </script>


 Note that "id" contains the id of the CONTROL that caused the postback. panelId contains a string that appends the event trigger with the UpdatePanel name.   Note that if the update was caused by an event configured in the Triggers Collection or updated explicitly in JavaScript, the "Control" name will be the UpdatePanel.

Saturday, April 19, 2008 6:50:00 AM (Atlantic Standard Time, UTC-04:00)  #    Comments [6] - Trackback
AJAX | ASP.NET | Misfit Geek [Syndicated]
# Thursday, April 17, 2008
Thursday, April 17, 2008 12:09:32 PM (Atlantic Standard Time, UTC-04:00)  #    Comments [8] - Trackback
AJAX | ASP.NET | Misfit Geek [Syndicated] | Videos
# Wednesday, April 16, 2008

DreamSpark

Look at the stuff students can download for FREE !

Visual Studio 2008 Professional Edition
Windows Server 2003 Standard Edition

SQL Server 2005 Developers Edition
Expression Studio

XNA Game Studio
XNA Game Studio

Visual Studio 2005 Professional Edition

This program was announced in February but it seems like alot of students still don't know about it.

Students, get the details HERE.

Wednesday, April 16, 2008 1:24:38 PM (Atlantic Standard Time, UTC-04:00)  #    Comments [2] - Trackback
Dev Community | Misfit Geek [Syndicated]
# Monday, April 14, 2008

BlogEngine.NET

Today, while sitting in a discussion about the new Microsoft MVC Framework at the Microsoft MVP summit, I got an email (reading on my phone) from Kevin Karasinski, a developer at Sandcastle Interactive.

The subject line of the email was my blog password !

Kevin sure knows how to get a guys attention :)

Kevin, good guy that he is, was taking the time to let me know about a newly discovered (and already fixed) security defect in BlogEngine.net, which is the blogging engine that I use here at JoeOn.net. 

Thanks Kevin, you gave me a freakin' heart attack !!!!

Needless to say, my blog has been patched to remove the defect.

Kevin pointed me to Danny Douglass' blog entry HERE.

And [ HERE ] is the official BlogEngine.net patch announcement.

Kudos to Danny, and the BlogeEngine.net guys for fixing this so quickly.

And thanks to Kevin for taking the time to let me know, though maybe next time you can just call my cell phone :)

Monday, April 14, 2008 4:02:14 PM (Atlantic Standard Time, UTC-04:00)  #    Comments [4] - Trackback
ASP.NET | Misfit Geek [Syndicated] | Partners & Products
# Sunday, April 13, 2008

I get an obscene amount of email. Since I've been working with the Developer Community at Microsoft for 7 years, my email address has been spread around a bit. I get about 1000 email a day. Very often from developers who what me to write code for them :)

I generally don't have time to do that, but sometimes I get an email from someone why has really tried to solve a problem that should be simple, but whose answer is not always as obvious as the problem would lead you to believe.

This week a Developer emailed me about updating an UpdatePanel.

One of the true strengths of ASP.NET is the ability to take several different approaches to writing applications based on your needs and preferred development style.

Though I think the UpdatePanel control is AWESOME, my personal preference for AJAX style programming leads me to write more client side code and communicate with the server via JavaScript enabled web service calls.

The problem was, the developer was using the UpdatePanel and, due to functionality in the business layer, he needed to prevent the user from click a submit button twice in a row. Meaning, when the user clicks the button that caused the UpdatePanel to update, he needed that buttonto be disabled until the UpdatePanel's refresh was complete.

Before Click.....

Pre-Update

Then, after the click but before the UpdatePanel has completed it's update.....

After_Click

And yes... I know that in a real application one should add some updating indicator.

So, the UpdatePanel definition looks like this.  

   22         <div>

   23             <asp:UpdatePanel ID="UpdatePanel1" runat="server">

   24                 <ContentTemplate>

   25                     <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>

   26                     <br />

   27                     <br />

   28                     <asp:Label ID="Label1" runat="server" Text="Label" Width="622px"></asp:Label><br />

   29                     <br />

   30                 </ContentTemplate>

   31             </asp:UpdatePanel>

   32         </div>

   33         <br />

   34         <input id="SubButton" style="width: 618px" type="button" value="Call UpdatePanel Method" onclick="return SubButton_onclick()" />

   35         <br />

   36         <br />

 

Note that the HTML button control "SubButton" is outside the UpdatePanel and is not defined as a Trigger to the UpdatePanel.

 

In order to turn the Button off and get the UpdatePanel to update, we're going to do it all in JavaScript.

If you use an ASP.NET Button control and disable the Button with an OnClientClick event handler, that code fires first and the postback never occurs.

 

Our JavaScript "SubButton_onclick()" function looks like this.

 

    4 <script type="text/javascript">

    5 <!--

    6 function SubButton_onclick()

    7 {

    8     var prm = Sys.WebForms.PageRequestManager.getInstance();

    9     var mybutton = document.getElementById('SubButton')

   10     mybutton.disabled = true;

   11     prm._doPostBack('UpdatePanel1', '');

   12 }

   13 // -->

   14 </script>

 

Hopefully the code is self explanatory. 

 

The Button is disabled and the UpdatePanel postback is triggered.

 

But.... How do we know when the update is complete so we can re-enable the Button.

 

 

   37 <script type="text/javascript">

   38 <!--

   39 var prm = Sys.WebForms.PageRequestManager.getInstance();

   40 

   41 prm.add_endRequest(EndRequest);

   42 

   43 function EndRequest(sender,args)

   44     {

   45     var mybutton = document.getElementById('SubButton');              

   46     mybutton.disabled = false;

   47     }

   48  -->

   49 </script>

 

Luckily, the PageRequestManager is throughly evented. :) 

 

We just add an "EndRequest" event handler and have it re-enable the Button.

 

Pretty simple after you see the solution :)

 

[ Download the code HERE. ]

 

Sunday, April 13, 2008 3:53:57 PM (Atlantic Standard Time, UTC-04:00)  #    Comments [11] - Trackback
AJAX | ASP.NET | Misfit Geek [Syndicated]
# Friday, April 11, 2008

Alice

Say hello to Alice. [ More info here. ]

From their web site......

In Alice's interactive interface, students drag and drop graphic tiles to create a program, where the instructions correspond to standard statements in a production oriented programming language, such as Java, C++, and C#. Alice allows students to immediately see how their animation programs run, enabling them to easily understand the relationship between the programming statements and the behavior of objects in their animation. By manipulating the objects in their virtual world, students gain experience with all the programming constructs typically taught in an introductory programming course.

Friday, April 11, 2008 6:24:25 AM (Atlantic Standard Time, UTC-04:00)  #    Comments [3] - Trackback
.NET | Dev Community | Misfit Geek [Syndicated]
# Thursday, April 10, 2008

Today Scott Guthrie posted about the new preview availability of ASP.NET Dynamic Data. [Click HERE to read his post.]

I know, the pace of new releases makes it hard to keep up and you need to pick and choose which things you invest your time in!

When you hear about ASP.NET 3.5 "Dynamic Data", you often see a screen-shot like the one Scott blogged.

step11

Resist the temptation to say "Yea, another datagrid control".

This is one of the most exciting new ASP.NET Technologies.

I'll be presenting on ASP.NET 3.5 Dynamic Data at ASP.NET Connections in a couple of weeks.

ASPCOnnections

After that - would you all like some How-D-I videos on Dynamic Data ????

Thursday, April 10, 2008 7:30:22 AM (Atlantic Standard Time, UTC-04:00)  #    Comments [9] - Trackback
ASP.NET | Misfit Geek [Syndicated]

Family

I nearly never make non-technical posts to my blog, but today is my wife's birthday - and since I've developed friendships with so many of my readers, I wanted to wish Jill happy birthday "Out Load". (Thanks to my geek readers for indulging me.)

Jill, after 10 years, I Love you every bit as much as I did on the day I asked you to marry me. 

You are everything!

And, though I don't tell you often enough, I thank god every day for crossing our paths. I have no idea what I did to deserve you and our children, but life wouldn't be worth living with out you.

I promise to work to make this year one of your happiest !

I'm sure all my readers join me in wishing you the loudest Happy Birthday !

Thursday, April 10, 2008 6:31:53 AM (Atlantic Standard Time, UTC-04:00)  #    Comments [9] - Trackback

Navigation
About Me
    Joe Stagner
Follow me on Twitter.

View Joe Stagner's profile on LinkedIn

MSDN

Search
RSS/Subscribe
  RSS 2.0 | Atom 1.0 | CDF  
Archive
<April 2008>
SunMonTueWedThuFriSat
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910
Contact
Send mail to the author(s)  Send me email.
Statistics
Total Posts: 447
This Year: 3
This Month: 3
This Week: 3
Comments: 1449
Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2009
Joe Stagner
Sign In
Gaciously Hosted by MaximumASP.net
MaximumASP ROCKS !!!.
All Content © 2009, Joe Stagner