onsdag 29. april 2009

MSDTC

Oh the joy of working with microsoft technology eh?

Project crashes with a "MSDTC not available on MACHINE" error. So I go on the internets to find out what MSDTC is. So after finding out that I need to know how to start this Distributed Transaction Coordinator service.

After the tenth google hit I still haven't gotten a simple answer, so just for the hell of it I try the logical thing:

> net start msdtc

And it works. Frack me.

tirsdag 14. april 2009

Multiple selection in GridView (asp.net)

In order to get multiple selection in a GridView, you need a field in your datasource that is unique. Then use a checkbox with the unique field to do multiple selection:



<asp:gridview>
<columns>
<asp:templatefield headertext="Select">
<itemtemplate>
<asp:checkbox id="cbSelect" runat="server">
<asp:label id="uniqueId" runat="server"
text='<%# Eval("uniqueid") %>'
CssClass="hidden" />
</asp:label>
</asp:checkbox>
...
</itemtemplate>
</asp:templatefield>
</columns>
</asp:gridview>


You can then loop through the rows in the GridView and see which ones have been selected, picking out the unique ids for those.

The CSS for hidden is simply:

.hidden {
display: none;
}

Which hides the item, but still renders it in html so that you can retrieve it (unlike Visible=false which does not render it in html at all).