Bouncing Ma'ss

Techinical bits from a Bouncing Fish.

Thursday, March 16, 2006

Getting Bloomberg COM Interop to Work

Or: How to edit interop stubs automatically generated by VS.NET etc,

Or: How to deal with COM's optional parameters in .NET

Broken ASP

Keywords:

Reinstall COM+
OC_COMPLETE_INSTALLATION
ASP
DCOM got error "Logon failure: unknown user name or bad password. " and was unable to logon
The server failed to load application '/LM/W3SVC/1/ROOT'. The error was 'The server process could not be started because the configured identity is incorrect. Check the username and password.

Symptoms:

ASP and ASP.NET pages broken, HTML and graphics OK, attempting to debug web applications kills server, various COM+ errors in event log, COM+ browser in Component Services crashes.

Cause:

COM+ install has been corrupted.

Solution:

Reinstall COM+ by deleting HKLM\SOFTWARE\Microsoft\COM3 key and rerunning add/remove windows components. If this doesn't work, follow instructions here (cached), paying attention to the regsvr32 /s ole32.dll and regsvr32 /s oleaut32.dll commands not documented in the MSKB solutions.

New member Shak!

Bouncing Ma'ss welcomes Shak to the group.
Me feels a name change coming.

Thursday, March 09, 2006

ASP.NET Event firing

How do you spell firing?

Anyway, recently I had a baffling problem with ASP.NET which when resolved changed my understanding of the ASP.NET Event Firing Sequence. (Fixed it if you will).

I had a GridView. I as was adding buttons to a cell of the GridView .
Problem:
  • Data-Binding only occurs on the !IsPostBack load of a page.
  • Dynamically added controls do not persist over post backs like a controls value (or a GridViews rows) do.*
As my controls were being added by RowDataBoundEvent, they'd disappear unless I explicitly called DataBind in Page_Load.

Here's the event conundrum that had me for a while and taught me the lesson.
My dynamic buttons survived the first load so I didn't muchly care they disappeared after clicking them, well I did but I was still perplexed as to why they didn't actually do their work.

I expected adding a handler to the dynamic button to give it Client side button something like this:

onclick="do what you're told"


But it didn't.
Why?
Because it does this.

onclick="tell me you were told to do something"


Then when the postback happens. ASP.NET rebuilds the page, figures out who's interested and calls them. Therefore, as my dynamic buttons weren't put back on the page (as there was no databind()) this happened:

onclick="I got clicked"
asp="I don't know who you are, sorry"


I don't think I like ASP.NET because it does such simple thing in such convoluted ways. I understand its a result of the internet and not ASP.NET's fault. I just don't like it.

I'm going to install Ruby On Rails.

*This to me says that a GridView is bound once when its loaded and once again when it fires an event. Hmmmmm