Cool website of new products

June 1, 2009 at 11:30 AMJeffery

It's www.GearNerd.com. It is my brothers site and he spends a lot of time getting this information for everyone to see what new products are being released. It is mostly computer parts and accessories.

Check it out and subscribe to the RSS feed too.

www.GearNerd.com

Thanks,

Jeffery

Posted in: Computer | General

Tags: ,

Problems with the CreateUserWizard

May 21, 2009 at 2:57 PMJeffery

The problem I had was that no matter what I did it would not take me to the next step that I had. I finally found the answer but took me many  hours of looking, so I thought I would share this.

Actually the fix is very easy and this problem happens when using the CssFriendly Control Adapters. And the fix it to comment or delete out of the CssFriendlyAdapters.browser file the entry for the CreateUserWizard control.

 

i hope this helps someone as I wasted a lot of time on this problem.

 

Thanks,

JefferyS

Posted in: ASP.NET 2.0+ | Programming

Tags:

DropDownList inside a DetailsView, how to databind

May 12, 2009 at 9:10 AMJeffery

It's been far to long sense I blogged. Sorry about that.

An application I'm programming has a DetailsView with a DropDownList inside. I had a lot of trouble getting this to work so I thought that I would share this information to make it easier for someone else.

This may not be the best way but it seams to work ok. A lot of articles I've read about this use some sort of datasource in the aspx page. I thought the idea was to separate presentation from the business logic so I try to stay away from that.

Basically you have a DetailsView like this (I've removed a lot of extra code and left the important code to make it less confusing):

<asp:DetailsView ID="dvItem" runat="server" CssClass="detailsView" DataKeyNames="ItemIdPkey"  onDataBound="dvItem_DataBound">
    <HeaderTemplate>
            Title
    </HeaderTemplate>
        <Fields>
            <asp:TemplateField HeaderText="Category">
                <ItemTemplate>
                    <asp:Label ID="lblCategory" runat="server" Text='<%# Bind("ItemCategoryName") %>'></asp:Label>
                </ItemTemplate>
                <EditItemTemplate>
                    <asp:DropDownList ID="ddlCategory" runat="server">
                    </asp:DropDownList>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:DropDownList ID="ddlCategory" runat="server">
                    </asp:DropDownList>
                </InsertItemTemplate>
            </asp:TemplateField>
</Fields>
</asp:DetailsView

 The necessary parts are the onDataBound event and having the DropDownList in an Edit or insert template.

Of course you would have all the other events that go with editing, inserting, mode changing, etc...

Now for the C# code:

protected void dvItem_DataBound(object sender, EventArgs e)
{
    if (this.dvItem.CurrentMode == DetailsViewMode.Edit)
    {
        DropDownList ddlCategory = (DropDownList)this.dvItem.FindControl("ddlCategory");
        if (ddlCategory != null)
        {
             DataTable dt = ItemCategory.ItemCategorySelectAll().Tables[0];
             ddlCategory.DataSource = dt;
             ddlCategory.DataTextField = "itemCategoryName";
             ddlCategory.DataValueField = "itemCategoryId_Pkey";
             ddlCategory.DataBind();

             WishListItem li = (WishListItem)this.dvItem.DataItem;
             ddlCategory.Items.FindByValue(li.ItemCategoryFkey.ToString()).Selected = true;
           }
     }

}

 This is only showing the edit mode code but the Insert code would be about the same except for the finding of the value to make it selected. The last two lines should be deleted.

 I also found that when accessing the DataItem you need to use the type of datasourse that you gave it. In this I have a class WishListItem that was the datasourse. If you used a DataTable or DataSet then you would assign that to the DataItem. Hope that made sense.

If you have any questions please let me know.

Thanks,

Jeffery

 

 

Posted in: ASP.NET 2.0+ | C# | Programming | DetailsView

Tags:

Visual Studio 2008 Error List pops up a lot in webforms code view

February 19, 2009 at 4:42 PMJeffery

There are some things about Visual Studio 2008 that annoy me. One of the worst ones is when you'll be typing away in code view on an asp.net page and the Error List bounces up and down. The cause of this is the page validator you have set and when it finds a asp.net control or HTML control or a css class that it can't find or is not valid it pops up the Error List. Also when using Themes the IDE in code view doesn't seam to see the style sheets you have. So when typing away setting the Id of a label control or something the Error List jumps up and down when you arrow or mouse away form what you were just typing.  I hope this makes sense. I have looked for a solution and found some people just disabling the validator. Hiding the Error List does nothing because it keeps coming back. So while trying to see what I could do I right clicked on the error list and there it was   an option, that are on a lot of  little windows in the IDE, to set the Error List as a Tabbed Document!

I can handle that being a tab with the rest of my documents. So no more bouncy Error List to get in the way or annoy me. And If I need to look at the list of errors and warning I just click on the tab.

I know this isn't all that exciting but it helps me concentrate on the programming and not watching the Error List flash on the screen.

 

Sometimes it's the little things in life that makes us happy.

 

JefferyS

Posted in: Programming | Visual Studio 2008

Tags:

Follow up to recent programs list problem

January 8, 2009 at 3:51 PMJeffery

It took me a bit but I found out why the programs were not showing up on the list. Evidently when I unchecked the box to show recent programs it had set the number of programs to show on the list to zero. So all I had to do is change the 0 to a 9 and everything was good.

Thanks,

JefferyS

Posted in: General

Tags: