Recent twitter entries...

Make Visual Studio 2010 faster and more enjoyable

Posted by Brad | Posted in Coding | Posted on 13-07-2011

Here are a couple of tips and tweaks that should make your visual studio 2010 experience less of a dragggggg..

Set your visual experience general environment options as follows, I have not noticed any real difference in the prettiness of the IDE but then I mainly develop console and asp.net applications

1) Uncheck Enable rich client visual experience

2) Check Use hardware graphics acceleration if available

Tweak1 500x290 Make Visual Studio 2010 faster and more enjoyable


Set your startup to an empty environment so the beast starts quicker without having to lookup a bunch of RSS feeds and have a think about what has been done recently so you can just get on with what you want to do.Tweak2 500x290 Make Visual Studio 2010 faster and more enjoyable


If you have an active anti virus product on the computer find the advanced setting that enables you to exclude certain files/folders from runtime scanning in my case I exclude the following from my avast scanner.

AntiVirus 430x400 Make Visual Studio 2010 faster and more enjoyable


Sure there are many other software options that can help but these are some easy ones that should make a big difference to your development experience.

I was at the guathon at Leicester Square in London today

Posted by Brad | Posted in Coding | Posted on 06-06-2011

Having my brain hammered by the latest asp.net mvc3, knockout.js, c#5 asynchronous web apps… and azure cloud deployment… was quite a fast paced day.

P1020214 500x375 I was at the guathon at Leicester Square in London today


P1020216 500x375 I was at the guathon at Leicester Square in London today


P1020218 500x375 I was at the guathon at Leicester Square in London today

Binding a GridView in C# with a parameterized command

Posted by Brad | Posted in C# | Posted on 14-07-2010

With two controls on your asp.net page a DropDownList (ID ddlDropDownList) and a GridView (ID gvGridView), to retrieve the SelectedValue from the DropDownList and use that in the where clause of the query used to bind data to your GridView the following will help.

Required using statements

[codesyntax lang="csharp"]
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
[/codesyntax]

ADO.NET block of code to base your bind on using an SQLDataAdapter so you can still have paging on the GridView.

[codesyntax lang="csharp"]

    using (SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["CONNSTRINGNAME"].ConnectionString))
    {
      using (SqlCommand cmdGrid = new SqlCommand("SELECT * FROM TABLE WHERE FIELD = @PARAMETER", con))
      { 
      cmdGrid.Parameters.AddWithValue("@PARAMETER", ddlDropDownList.SelectedValue);
      con.Open();

      using (SqlDataAdapter da = new SqlDataAdapter(cmdGrid))
      {
        DataTable dt = new DataTable();
        da.Fill(dt);           
        gvGridView.DataSource = dt;
        gvGridView.DataBind();
      }
      }
    }

[/codesyntax]

The structure of the code is with using statments to ensure the garbage collection is carried out efficiently.