Insert:    
Visibility:     Module:   
 
Register Login
Home    May 20, 2012
Spring on the Gulf Coast Minimize
Displaying 1-8 of 54 items.
Pirates CoveRelics
SunkTipsy
The CoveNice View
Conference CallDSC_8308_9_tonemapped.jpg
 
Gulf Shores News and Headlines Minimize
Sat, 19 May 2012 22:33:58 -0500

al.com (blog)

Hangout Fest Day 2: Julian Marley and Heartless Bastards
al.com (blog)
By Dennis Pillion, al.com View full sizeJulian Marley plays the main stage at the Hangout Music Festival on Saturday, May 19, 2012. (Dennis Pillion / al.com) GULF SHORES, Alabama -- A member of reggae royal family made his appearance Saturday at the ...
The Hangout draws crowds in second dayWALA-TV FOX10
Hangout Music Fest Kicks Off In Gulf ShoresWKRG-TV
Founder: Hangout Fest belongs to 35000 'shareholders'Press-Register - al.com
The Huntsville Times - al.com -The Birmingham News - al.com (blog) -Tuscaloosa News
all 50 news articles »
Fri, 18 May 2012 23:35:15 -0500

Hangout Music Festival: Safety and Security
WKRG-TV
Take thousands of festival goers from all over the country, bring them down south on the beach for a three day party and there could be problems. (more) They are here for the music but from the moment festival goers go through the gate where they are ...

Fri, 18 May 2012 22:04:08 -0500

Press-Register - al.com

SummerTide Theatre set to open musical revue 'Smokey Joe's Cafe' June 1 in ...
Press-Register - al.com
By Thomas B. Harrison, Press-Register GULF SHORES, Alabama — SummerTide Theatre, the professional summer theater of the University of Alabama, will return to Gulf Shores for the ninth season with the Tony Award-nominated musical revue “Smokey Joe's ...
SummerTide Camp June 5-23 in South Baldwinal.com

all 2 news articles »
Fri, 18 May 2012 18:06:36 -0500

Press-Register - al.com (blog)

S'mores on the Shore heats up Thursday in Gulf Shores
Press-Register - al.com (blog)
By Press-Register staff GULF SHORES, Alabama --- S'mores, campfires, live music and the beach — what could be better? That's what officials in Gulf Shores are saying as they get ready for the first S'mores on the Shore of the season at 5:30 pm ...
Credit card skimmer pleads guiltyal.com (blog)

all 2 news articles »
  
 
Robertsdale News and Headlines Minimize
Sat, 19 May 2012 11:14:49 -0500

Two Lady Bears commit to colleges for softball
al.com
ROBERTSDALE — A pair of student-athletes at Robertsdale High signed college softball scholarships on Thursday. Center fielder Kayli Evans signed to play with Pensacola State College. “It means a lot to me because it's always been my dream to go play ...

Sat, 19 May 2012 11:14:48 -0500

Battle of the Bay Soccer Showcase set for Friday
al.com
Taylor Sallis of Robertsdale sends in a corner kick for the Baldwin all-stars in the 6th annual Battle of the Bay Charity Soccer Showcase at WC Majors Field in May of 2011. (Press-Register/Robert Ladnier) FAIRHOPE, Alabama — The 7th annual Battle of ...

and more »
Fri, 18 May 2012 20:45:46 -0500

Robertsdale to get additional settlement from BP
Gulf Coast News Today
ROBERTSDALE, Alabama – The Robertsdale City Council will receive an additional settlement from BP Exploration & Production Inc. for lost revenues following the sinking of the Deepwater Horizon drilling rig and subsequent oil spill in the Gulf of Mexico ...

and more »
Fri, 18 May 2012 19:22:48 -0500

Robertsdale High volleyball camp set for May 29-30
al.com
Coach Santiago Restrepo of the University of Oklahoma sets the volleyball during a drill at the Metta Roberts Volleyball Camp in Robertsdale in May, 2008. (Press-Register/Robert Ladnier). ROBERTSDALE, Alabama — The 10th annual Metta Roberts Volleyball ...

Fri, 18 May 2012 00:10:23 -0500

Five Robertsdale High student-athletes sign scholarships
al.com
ROBERTSDALE, Alabama — Five student-athletes, two from softball and three from baseball, at Robertsdale High signed college scholarships on Thursday. Center fielder Kayli Evans, who hit .339 with 23 RBIs as a senior, signed to play softball with ...

and more »
  
 
Recent Entries from Local Blogs Minimize
Jun 10

Written by: anomaly
6/10/2005 8:23 AM  RssIcon

In the July issue of MSDN Magazine, Dino Esposito provided an excellent article on allowing DHMTL in ASP.Net Controls.  This is a core concept for a project that I am working on,  so I thought I would share my particular solution to the problem.

First, the problem.   -- If you use DHTML and client-side scripting to manipulate server side objects, whatever attributes of those HTML elements that were changed since initial page render via DHTML will be lost on postback.   My particluar need for DHTML was related to allowing users to move controls around a webform (a form designer) and then saving the new X/Y coordinates of those controls for later use. 

Inspired from Mr. Esposito's article, I decided to model my solution using a single hidden field.   I wasn't excited about this approach but I did consider it to me a good alternative to the common approach of adding one hidden field per DHTML-manipulated server control.

Since my particular need was to capture X and Y coordinates of controls that have been moved around a webform, in the DHTML javascript events fired after the control is dropped into place, I added code to se custom attributes representing the current coordinates.   In this case dd.obj is whatever object was moved.

document.getElementById(dd.obj.name).setAttribute("x",dd.obj.x);
document.getElementById(dd.obj.name).setAttribute("y",dd.obj.y);

This code adds the custom attributes, X and Y to the DHTML layer that was dragged to a new location.   Now, I must be able to persist these custom attributes through the postback.

To the webform, or an external .js referenced by the webform, I added a javascript function to enumerate through all attributes for all divs and set a hidden field's value to a text string that we will be able to reverse engineer on postback to re-set those attributes. (Or, do whatever we would like)

function setAttribState(hiddenID){
 var attribState="";
 //Which HTML tags should we include in attribstate?
 //Div only for now.
 var tagnames = new Array();
 tagnames[0]='div';
 
 for(var h=0;h  var elem = document.getElementsByTagName(tagnames[h]);
  for(var i=0;i   var thisElement ="";
   var attribs = elem[i].attributes;
   var eleAttribs="";
   for(var j=0;j    if (attribs[j].specified){
     var thisAttrib = "";
     var thisAttrib = attribs[j].nodeName + ':' + attribs[j].nodeValue;
     eleAttribs += thisAttrib;
     if (j!=attribs.length-1){eleAttribs+=','};
     }
   }
   thisElement = elem[i].id + '/' + eleAttribs;
   attribState += thisElement;
   if(i!=elem.length-1){attribState+=';'};
  }
 }
 document.getElementById(hiddenID).setAttribute("value",attribState);
}
To the webform, add a hidden field called "__attribState".
Then, in the codebehind for the webform  I wired this javascript into the submit button's onclick event.
I did this by adding this to the page_load event: 
Button1.Attributes.Add("onclick", "setAttribState('__attribState')")
 In the same codehind, under the form click event, I added a call to iterate through the text and set the attributes.
 ReadAttribState("__attribState")

To the webform, I added the sub:

    Private Sub ReadAttribState(ByVal HiddenControlName As String)
        Dim hiddenctl As HtmlControls.HtmlInputHidden = CType(Page.FindControl(HiddenControlName), HtmlControls.HtmlInputHidden)
        Dim elements As String() = Split(hiddenctl.Value.ToString, ";")
        Dim element As String
        For h As Int32 = 0 To elements.GetUpperBound(0)
            Dim x, y As String
            Dim ctlId As String = Split(elements(h), "/")(0)
            Dim ctl As HtmlControls.HtmlGenericControl = Page.FindControl(ctlId)
            Dim attribs As String() = Split(Split(elements(h), "/")(1), ",")
            For i As Int32 = 0 To attribs.GetUpperBound(0)

                Dim attribName = Split(attribs(i), ":")(0)
                Dim attribValue = Split(attribs(i), ":")(1)
                If LCase(attribName) <> "id" Then
                    ctl.Attributes.Add(attribName, attribValue)
                End If
            Next
        Next
    End Sub

 Voilà.   When your DHTML event fires, it will set your custom properties.   Then, onClick, the form button will build a text string of all attributes for all divs and populate the hidden field.  On postback, your code will poll this field, parse the name/value pairs for each attribute and re-set those attributes on page render. In my implementation, I then use these custom attributes to set the style of my controls on page_load.

Until Next Time,

Bill Dodd
mcp, mcsd, mcad, mcdba

Tags:
Categories:
Location: Blogs Parent Separator DoddBlog

1 comment(s) so far...


Gravatar

Re: DHTML & ASP.Net Controls

ugg boots outle is possible to keep Franny boots clean using a damp rag. The best a part of the faux leather and nylon upper is that salt stains won't set in. That is often a problem for footwear made of organic fibers. You only acquire winter boots once ugg boots sale each number of years, so decide on a pair that can last coach purses outlet. Sporto boots are durable and provide comfort with fashion flair.
Men and women looking for distinctive footwear might consider a pair of boots within a bright or distinctive colour. There are many options to choose from, but cheap coach purses red boots are becoming popular. This stunning footwear can be the perfect addition to any wardrobe. It's important to seek out boots which can be trendy, functional, and comfy.
Should you be looking for hiking boots, this Italian ugg outlet is actually a very very ugg classic short sparkles good spot to start out. They is situated in Northern Italy in which the Alps usually are not far. They've manufactured it their mission to make shoes and boots particularly for ugg outlet store. Asolo hiking boots are top coach outlet store online rated good quality and undoubtedly worth searching into coach purse outlet.
Probably the most comfortable pair ugg bailey button triplet I've ever owned is really a pair of black ugg bailey button sale, leather over-the-knee Franco Sarto boots. They offer a massive selection of all types and Report Footwear makes super trendy cost-effective ugg bailey button boots if you're trying to find slouchy boots or perhaps a pair of trendy ugg boots clearance highs having a heel. Each could be found at retailers like Macy's, Nordstroms and ugg bailey button triplet sale online. In case you prefer on the web shopping, try ugg boots sale which provides totally free shipping ugg classic short sparkles each approaches.
The lining extends for the ankle so you're warm from ugg classic short top to bottom when uggs for cheap wearing these footwear. The accessible zipper up the front in the boots tends to make it easy to eliminate them and slip them back on, even when you're wearing many ugg boots clearance or probably carrying some added winter weight. A mix of faux leather and quilted nylon produces a pair of boots that could make it through harsh climate. ugg boots sale For those who've dealt with blizzards or snowstorms, you realize a shoe that may make it by means of this kind of situations is necessary.
The final design is a simple flat soled boot. Generally a basic design will probably be lined within. They cease just past the ankle, but could also go midway up the calf cheap uggs. Some have laces, whilst other uggs on sale people slip onto the foot. Basic boots are perfect for people who live in cold climates and are searching for a enjoyable addition to their footwear collection.

By DFSDF on   12/3/2011 12:32 AM

Your name:
Gravatar Preview
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Add Comment   Cancel 
 
Gulf Coast Photography: Bill Dodd on Flickr Minimize
Displaying 1-12 of 49 items.
Epcot: Japan [Explored]Golden Hour
Pier at the BayFort Morgan Fishing Pier
Seated Beneath Blue Cotton [Explored]Nature's Litter
The Gulf Shores SunsetFairhope Pier Sunset from Overlook
The Good LifeThe Boardwalk @ Johnson Beach and a small tale. :)
A Good Way to End the DayFairhope Pier at Sunset
 
 Happy Holidays!   Terms Of Use  Privacy Statement