Thursday, May 18, 2006

Am I sitting on a gold mine? (updated 10 years later..)


According to my neighbor, my condo may actually benefit me most by not selling because of the Metro rail stops coming way out in the future. Interesting source of hope, atleast.


Here is my condo for sale listing online :

ParcReston Condos For Sale


http://www.dullescorridorrail.com/project.htm


.... 10 years later .. Sadly No. Prices have dropped further.

Saturday, May 06, 2006

Derby Day (2006 KY Derby 10 years later..)





My picks are :

Brother Derek
Bob And John
Point Determined
Sinister Minister

Tie Breakers :
Barbaro
AP Warrior

I like to cheer Bob Baffert's horses because I read an interesting story about his life in Sports Illustrated. Just seems like an inspiring guy.



10 years later ...
I still follow Bob Baffert in racing, and of course that has been popular, and for good reason. Bob has won the Triple Crown with American Pharoah and has been one of the most successful trainers of all time.
For the longest stretches of time, I simply put all of my money on his horses with blind faith, and that would end the day positive. Unfortunately, Baffert is the 1990's Dallas Cowboys of horse racing. Bettors rush to the windows when he runs a horse, bringing down the payout for a win. That's just fine, as I have learned since, that trainers run tons of horses over time, and they are not all equal. Betting involves analyzing not just win/loss(placing) records for the athlete, but also speed figures, scheduling, training, surface selection, pedigree, weather bias, and competition that day as well as countless other factors. As a pure fan of racing, regardless of how it affects my bank balance, this article just pinpoints a good observation by a brand new fan in 2006. ( Now 2017 )


I don't remember what exactly a "tie breaker" was in that post above. But, we all know Barbaro won the Derby that year. Sadly, Barbaro died from a leg injury shortly after. Brother Derek went on to be sire of tons of successful race horses. I am not sure about the others which were from the Baffert barn.

Friday, May 05, 2006

GridView challenge

How to get a button column that will confirm on the client side, but that does not have one of the standard "Select", "Delete", "Edit", "Update" command name property values?

Much is buzzing on the internet about the wonderful "onClientClick" property which you can set for a LinkButton inside of an ItemTemplate of a GridView. Now I have seen Scott Guthrie and Fritz Onion writing about it. And I certainly love the ability to simply ask "window.confirm" in the on-client event for the "Delete" button for example. But I am wondering can I do this for some other use cases, such as when I have no SQLDataSource bound to the grid, just a DataSet pumped into it at Page Load, or I have an SQLDataSource but with only "Select" command defined?
I wonder if the onClientClick -> Confirm technique can apply for a regular button column, not part of an ItemTemplate?

Maybe this is no biggie, I have worked around it thusfar. Maybe GridViewGirl knows the answer?



Link to my question to Fritz Onion, ASP .NET expert.



I have found a way to the RowIndex of the item clicked, even if it is not marked up with standard CRUD database operation attributes.

Using :


((e.CommandSource as ImageButton).Parent.Parent as GridViewRow).RowIndex;


I can get to the DataKey I need in the array of DataKeys in the grid.

Tuesday, May 02, 2006

To Page or Not to Page?

This is going somewhere I promise.
Visual Studio 2005 makes very easy the whole listing of data with paging links at the bottom. If we use a SQLDataSource object on the ASP page, all the paging and sorting is handled automatically, and can even have an AJAX kind of functionality if we turn on "EnablePagingAndSortingCallbacks". the grid pages and sorts without what some people consider to be a nasty page flash.

In a meeting about 2 months ago, some ultra-powerful managers shreaked in fear of the little numbered paging links at the bottom of the page. They demanded the pages be switched to scrolling wherever possible. So I promptly wrapped my GridView controls in DIV tags with style "overflow-y:scroll". This accomplished some immediate relief but not without some hangover.

If the user does some interacting with your list items, and a PostBack occurs, your page will refresh with the scroll position back to the top and the item down in the list the user was playing with, will be invisible. Thanks to Scott Guthrie for reminding us of the "ScrollIntoView" javascript function.

That article

One thing I would warn about is that controls get named AGAIN with unique names by the ASPX page when they are rendered, so you have to get that unique name down to the client javascript for it to be able to find the GridView row you want "scrolled into view". The control on the client side will end up with an ID such as

"ctl00_ContentPlaceHolder1_GridViewMyListOfItems_ctl51_ctl00"

What a mess.

here is a partial code sample to attempt to scroll this thing :



// Assuming you wanted the 112th row and
// had an index variable to use here,
// not a hardcoded one
Control control =
myGrid.Rows[112].Cells[1].Controls[1] as Control;

string scriptText =
"< script >
document.getElementById('" +
control.ClientID +
"').scrollIntoView(); < /script >";




Doing all this in the PreRender phase of the page lifecycle, you can get the script into action with a call to "ClientScript.RegisterStartupScript" or some other variant in the array of new client scripty things in .Net.

Now if we could just get my management to agree on a standard for this, my days would be half as long ;-)

XSLT Woes

Today I have a Google groups dialogue in progress with a major XML guru,

Martin Honnen --- MVP XML
http://JavaScript.FAQTs.com/

I think this may have some wide appeal to those of us who want to use XML/XSL for formatting things. With the new versions of the browser, Microsoft .NET, and the XML standards in general, I have been stuck in the mud on getting something out of my transformations.

I link to my Google post here and will paste the solution, if there is one

Thread Here


ANSWER!!
It is all about the NameSpace. I wondered if that could be a problem, but had no hint as to how I would solve it.
Seems my XML came from Microsoft .NET with a nice big tacky


xmlns="http://tempuri.org/PurchaseData.xsd"


This required me to declare the namespace in my XSLT as :


xmlns:prd=
"http://tempuri.org/PurchaseData.xsd"
exclude-result-prefixes="pd"


And to be sure the prefix my selection criteria in the actual XSL commands with that namespace and a colon.

I was wanting to use this technology for an emailed report thing, but have since gone on to employ a Page_PreRender event handler which captures all the HTML of a page by calling RenderChildControls, and then emails that.