Read subfolders with the Scripting.FileSystemObject: <% Dim fso Dim ObjFolder Dim ObjSubFolders Dim ObjSubFolder Set fso = CreateObject(“Scripting.FileSystemObject”) Set ObjFolder = fso.GetFolder([folder path]) Set ObjSubFolders = ObjFolder.SubFolders Response.Write(“<ul>”) For Each ObjSubFolder In ObjSubFolders Response.Write(“<li>” & ObjSubFolder.Name & ” – ” & ObjSubFolder.Path & “</li>”) Next Response.Write(“</ul>”) %>
matt
Entity Framework Filter Child Entity
I was looking for a way to filter child entities with eager loading. I ran into this useful blog post by Beth Massi on the subject. Here is the code I ended up using. It doesn’t work with server-side paging, but I didn’t need it in this case. Dim query = (From x In db.OrderChecklistItems […]
Entity Framework GridView RowDataBound
I found it tricky to get actual entities in the GridView RowDataBound event. Per Diego Vega’s post here, this may only happen because I am using the EntitySetName property of the EntityDataSource. Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then Dim descriptor As ComponentModel.ICustomTypeDescriptor […]
jQuery Get Next Textbox in a GridViewRow
In a GridView I have a column of checkboxes and a column of textboxes. I wanted to modify the value of the textbox when the checkbox is checked. jQuery is the perfect fit for this. Here is the code I used: $(function () { var $inp = $('input:checkbox'); $inp.bind('click', function () { […]
Entity Framework Count Related Entities Without Loading
I ran across this post on Stack Overflow. Here is the code I ended up using: Dim count = (From x In db.Orders Where x.OrderID = orderID From y In x.OrderDetails Select y).Count
GridView Row Index in Markup
Sometimes I want to show the e.Row.RowIndex of a GridViewRow in the markup of the page. I don’t want to hook into the RowDataBound method just to display a simple number. The answer varies for GridViews and Repeaters. Click here for the complete rundown. GridView: <asp:Literal runat="server" Text='<%# Container.DataItemIndex + 1 %>' /> Repeater: <asp:Literal […]
HTML Email CSS Guide
This guide is a must use for sending HTML email newsletters: http://www.campaignmonitor.com/css/
.Net Options for Data Access
Data Access Practices Using Microsoft .Net: A Nerdly Comparison In this article a comparison of these options: – Connected Data Access with ADO.NET– Disconnected Data Access with ADO.NET and Typed DataSets– Basic Object Relation Mapping with LINQ to SQL– Object Relational Mapping with LINQ to Entities and the Entity Framework See also: Extending NerdDinner: Exploring […]
JavaScript Objects
See article: Create Advanced Web Applications With Object-Oriented Techniques
Vertically align image to the middle
I was trying to align some text to an image vertically. I used the align attribute like this: <img height=”28″ src=”/images/connect-phone.gif” width=”26″ align=”middle”> 234-234-2342 But this didn’t work in Firefox or Safari. So I sought out the CCS alternative. I came across this article explaining how to do it: http://www.webmasterworld.com/forum83/6588.htm . Here is the code […]