About the author

Brian Keating is a developer addicted to Microsoft Technologies.

Month List

RecentComments

Comment RSS

Linq in asp.net

clock September 25, 2010 23:35 by author Brian Keating |

A quick sample of how to use linq in your webpages

 

<% Model.ToList().ForEach(item =>
{ %>
  <tr>
      <td>
          <%: Html.ActionLink("Edit", "Edit", new { id = item.AlbumId })%> |
          <%: Html.ActionLink("Delete", "Delete", new { id = item.AlbumId })%>
      </td>
      <td><%: Html.Truncate(item.Title, 25)%></td>
      <td><%: Html.Truncate(item.Artist.Name, 25)%></td>
      <td><%: item.Genre.Name%></td>
  </tr>
<% }); %>

 

I said quick ey!  :-)




Workflow Arguments how to

clock September 10, 2010 12:07 by author Brian Keating |

So you've started up your very first 4.0 Workflow application.
You've added some arguments and want to know how to pass some information..
You can either use the Dictionary approach that exists since 3.0 or you can use the properites you've just created.

 

Thes scrren shots show a simple workflow with an input string UserName and an output string Greeting.

 

 

 

I added an assignment activity and set the "To" to be the output Arguement "Greeting"

 

And set the Value as follows.

 

 

To prove this works I've added a test fixture and implemented it as follows

 

 

 

So there you go. The quickie for today Smile




Syncronization Context

clock September 8, 2010 21:17 by author Brian Keating |

A sample of using SyncronizationContext to post a message back to the UX thread

 

private void Window_Loaded(object sender, RoutedEventArgs e)
{
    SynchronizationContext ctx = SynchronizationContext.Current;

    ThreadPool.QueueUserWorkItem(_ =>
    {

        WebClient client = new WebClient();

        string html = client.DownloadString("http://www.briankeating.net");
        ctx.Post(state =>
        {
            tbDetails.Text = (string)state;

        }, html);

    });

}




MVC Stories

clock September 8, 2010 20:53 by author Brian Keating |

Hi All,

Been a while since I've writen some posts, been pretty hectic hours at work and weekends building a house so my chances to blog have been limited.

I intend over the coming few days to give a few tips and tricks on MCV2.

Here's on gottya..

Be carefull how you name your formal arguements in your controller functions.

You can see from the screenshot below that I created two args, "Name" and "name"

By default the first matching case insensitive value will be applied to both variables by MVC...

Usually this will be avoided by good naming conventions but be carefull nonetheless :-)