Monday, November 9, 2009
Passing arrays to SQL server as parameter
@param = ',one,two,three,'
SELECT * FROM foo WHERE @param LIKE '%,'+bar+',%'
Wednesday, October 28, 2009
IE8 and authentication cookies
<authentication mode="Forms" domain="yoursite.com">
Wednesday, September 23, 2009
Another way to preload images in javascript
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
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
Screen Keyboard Firefox Extension XUL Javascript Mozilla FireFox plugin Touchscreen Kiosk Input URL

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.