The Problem

Over the past several years I’ve found myself running into the same problem over and over so I thought I’d blog the solution so at least I don’t waste time figuring it out again.  So, when do you need this?  The answer for me is that I want to be able reference a web site without having to expose the underlying site structure.  For example, on the home page of my business, I want people to be able to type http://73rdstreet.com/Home and be taken to http://www.73rdstreet.com/HomeSite/Home.aspx.

The Symptom

You may see errors that say something like:

Server Error in Application … HTTP Error 404.0 – Not Found

(more…)

Seems, I keep forgetting where the temporary files asp.net uses. The reason it’s nice to know is sometimes you may want to open them with Reflector to see the generated code.  Also, sometimes, you want to delete those files because asp.net is confused and is reusing old ones.  So, here is the magic lines of code you need.

(more…)

I’m just starting out using WCF in an application for the first time.  I’m using Visual Studio 2008 sp1 and created an asp.net web site from the standard create project wizard.  I then created a simple AJAX–enabled WCF Service as follows:

image

I then added some code to the service that looks like the following (using MapPath):

(more…)

Solution File For VisualStudio 2008 GarminWebConversionOnly.zip

Several months ago, I bought a Garmin 705 Navigator for my bike.  As a gadget junkie, I always want to have the latest stuff.  For years, I’ve used Polar Heartrate monitors, but the idea of having maps on my handle bars was just to much to pass up.  Since the Garmin’s output is an XML file I figure I have an obligation to unravel it, and what better tool to do this than Microsoft’s LINQ to XML.  Many months ago I posted a similar article using LINQ to XML for showing the amount of space that was used on my TIVO by category.  This article is not quite an end to end solution like that one.  It’s just a first step.  What we will show is the steps necessary to convert the TCS file in data objects which we can use in future posts for display with technologies such as windows live maps.

(more…)

In my previous post, Assigning a DropDownList Value in a ASP.NET GridView Using ObjectDataSource, I discussed how to put a DropDownList value in a GridView.  As I explained, my motivation was to answer a common question that appears on often on the forums.  If you are wondering what my process is for deciding what to answer, there really is no process besides I see yet another question on the forum about this, and rather than answer it again, I write a post explaining it, then point my answer to the question at the post.  This is what I did yesterday and below is the response to this forum post.

x

(more…)

As a moderator in the asp.net forums, I often see the same or similar questions.  The answer to this question is pretty straight forward but not 100% obvious so I thought I’d do a post about in the hopes that with a couple key words, people will find the answer.  The title basically says it all.  We have a GridView that has a data column of type bool.  We want to display in the GridView Yes or No depending on whether the data value is true or false.  The example I’m showing does not help with making this an editable field (maybe a theme for another post if this one is popular) but simply shows yes or no.

The solution involves first dropping a GridView and ObjectDataSource onto your design surface in Visual Studio.  Then, using the little chevron on the GridView, choose edit columns and convert the column you are interested in making a DropDownList into a template.  From there replace the ItemTemplate with the DropDownList code below.  You get the code below.

 

<%@ Page Language="C#" %>
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 
<script runat="server">
 
</script>
 
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>ODS DDL Example</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetMembers"
            TypeName="BusinessObject"></asp:ObjectDataSource>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="Id"
            DataSourceID="ObjectDataSource1">
            <Columns>
                <asp:BoundField DataField="Id" HeaderText="Id" ReadOnly="True" SortExpression="Id" />
                <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
                <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
                <asp:TemplateField HeaderText="Approved" SortExpression="Approved">
                    <ItemTemplate>
                        <asp:DropDownList ID="DropDownListUser" runat="server" AutoPostBack="False" 
                            SelectedValue='<%# Bind("Approved") %>'>
                            <asp:ListItem Text="Yes" Value="True"></asp:ListItem>
                            <asp:ListItem Text="No" Value="False"></asp:ListItem>
                        </asp:DropDownList>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
        </asp:GridView>
    </div>
    </form>
</body>
</html>

 

And, when you run this code (assuming you have a simple business object that returns some data), you get this:

 

x

Hope this helps!

Untangle, a network software company in San Mateo California,  specializing in open source firewall software, has partnered with IDG World Expo to donate used laptops to schools in need.  In exchange, those that donate their computers will get a free conference day at LinuxWorld.  Below is a clipping from today’s San Jose Mercury News Advertising this.  This is a great way for those of us with old laptops to trade them in for some free education.  You can read more about this at http://www.untangle.com/installfest.

See you at Moscone Center!

 untangle1

I’ve had a love/hate relationship with Twitter for the past many months.  I really like the idea, I’ve got a pretty good community I interact with, and for the most part it works.  The hate part is that it is down way to often.  I often see posts where people say "Why to we stick with this sucky service?".  OK, maybe they don’t always use the sucky word.  At any rate, since this is my first Twitter post, I figure I should say that right away.

(more…)

© 2012 PeterKellner.net. All Rights Reserved