Tuesday, July 6, 2010

ASP.NET failure

Faulting application name: w3wp.exe, version: 7.5.7600.16385, time stamp: 0x4a5bd0eb
Faulting module name: mscorwks.dll, version: 2.0.50727.4927, time stamp: 0x4a27466f

can happen because you have messed with GAC (like I did)
readding assemblies using gacutil helps

Monday, November 9, 2009

Passing arrays to SQL server as parameter

A slow and dirty way:

@param = ',one,two,three,'
SELECT * FROM foo WHERE @param LIKE '%,'+bar+',%'

Wednesday, October 28, 2009

IE8 and authentication cookies

It's rather hard to google it out, here's how to make them work on any IE8:
<authentication mode="Forms" domain="yoursite.com">

Wednesday, September 23, 2009

Another way to preload images in javascript

function preloadImg(url) {
var divPreLoad = '<div style="height:0px; width:1px; background-image:url(' + url + ')"></div>';
document.write(divPreLoad);
}

Monday, September 21, 2009

DataList with automatically generated columns

DataList can repeat, but can't autogenerate.
DetailsView can autogenerate, but can't repeat (but requires a list as datasource, thus the array)


<asp:DataList ID="dvResults" runat="server" ondatabound="dvResults_DataBound">
<ItemTemplate>
<asp:DetailsView ID="subDvResult" runat="server" RowStyle-CssClass="row"
DataSource='<%# new System.Collections.Generic.List<System.Data.DataRowView>(new System.Data.DataRowView[]{(System.Data.DataRowView)Container.DataItem}) %>'>
</asp:DetailsView>
</ItemTemplate>
<SeparatorTemplate>
<br />
</SeparatorTemplate>
</asp:DataList>

Tuesday, August 4, 2009

Screen Keyboard

Here comes a brand new shiny and seeming to be the only one of a kind... I'll define it by a list keywords for Google to find:

Screen Keyboard Firefox Extension XUL Javascript Mozilla FireFox plugin Touchscreen Kiosk Input URL

My baby

It can modify textboxes in a webpage and the url textbox to enter URLs.

I'll open it to the opensource community after the guy who ordered it will pay :] Or after someone else writes it and the guy googles it out.

UPD: here it is

Because XUL and FF are around for like 5 years, and it took me like 3 days to create the thing. I'm sure this idea is crossing minds of another 99 code monkeys across the globe (and some forums posts show that they already did in the past, fruitlessly)

P.S.: being a dedicated fan of Opera, I must admit that FireFox IS a platform.
P.P.S.:Why the geck did Google give Chrome browser this name?

Thursday, July 2, 2009

UpdatePanel doesn't update

Once upon a time I had a master page with s number of Content placeholders. Also I had a page with an UpdatePanel in one Content and a GridView in another. What I wanted was the GridView row clicks to trigger UpdatePanels's refresh.

I tried OnSelectedIndexChanged (adding a LinkButton of Select command in the GW) with no success.

I tried to add another UpdatePanel2 as parent for the GridView with ChildrenAsTriggers=true, catch LinkButtons' OnClicks and update UpdatePanel 1 from there - the breakpoints didn't hit again.

The fast, dirty and easy solution was to replace those LinkButtons with and add following function (found somewhere in Internet) to its onclick:

  function forceAJAXPostback(eventTarget, eventArgument)
  {
  var prm = Sys.WebForms.PageRequestManager.getInstance(); 
  prm._doPostBack(eventTarget, eventArgument);
  }

Then in Page_Load I just parsed Request.Form["__EVENTTARGET"], and if it was what I passed (some constant), then Request.Form["__EVENTARGUMENT"] was used to update the UpdatePanel. UpdatePanel was set to conditional update.

Alternatively, you can pass a button id as eventTarget - it doesn't even have to be the UniqueId, add the button's Click to the UpdatePanel's triggers and do what you need in the button's Click handler. The button also doesn't have to be displayed.