Entries Categorized as '.net'
July 1, 2008
I have a method that handles sending of emails. I wrote it so that it would run asynchronously, so that it won’t slow down the web app. It looks like this:
protected static void SendMail(string to, string subject, string body)
{
try
{
using […]
Posted in .net, asp.net, asp.net mvc
1 Comment »
April 4, 2008
I have just spent the entire day playing with Moq to unit test an asp.net mvc application I am working with. All I wanted to do is test a “create” method that simply adds a record to the database. So here it goes.
1. I created a Mock Http context to be used by my controller. […]
Posted in .net, LINQ, Testing, asp.net, asp.net mvc
3 Comments »
Tags: asp.net, LINQ, mocking, moq, mvc, Testing, unit testing
March 31, 2008
This is the updated version of the Nikhil’s excellent example on how to use Ajax with ASP.net MVC.
I commented all the changes made in the code and prefixed them with //emad. So just search for //emad and you will see all the changes I made… Here is a quick list of the changes […]
Posted in .net, AJAX, Programming, Web Dev, asp.net
4 Comments »
Tags: AJAX, asp.net, code, mvc
February 20, 2008
Here is a quick tip. If you have the following Enum
Enum Frequencies
DAILY
WEEKLY
MONTHLY
End Enum
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, “Courier New”, courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { […]
Posted in .net, Programming, Tips & Tricks
No Comments »
February 19, 2008
I was writing a small utility for Outlook 2007 and was using LINQ to query Outlook Tasks. This query was nested within another query. While debugging, I realized that looping though the query results in my For Each loop was taking too long.
If you have read anything about LINQ, I am sure you already know […]
Posted in .net, LINQ, Office, Performance, Tips & Tricks, vb.net
2 Comments »
December 28, 2007
I need your help to bring me fame and fortune.
I wrote an article at code project which was entered for a competition. The winner gets $10k. Can you please check it out at http://www.codeproject.com/KB/WCF/myfeedreader.aspx and if you like it, please vote for it. I can’t win if you don’t vote. Voting will be closed on […]
Posted in .net, AJAX, LINQ, Programming, Tips & Tricks, Visual Studio, Web Dev, vb.net
No Comments »
July 31, 2007
As an example, I will call the getCategories API method.
Add a reference to the XML-RPC.net library.
Create a struct for the return result
Public Structure category
Public categoryId As Object
Public parentId As Object
Public description As Object
Public categoryName As Object
[…]
Posted in .net, Blogging, Programming, Tips & Tricks, vb.net
3 Comments »
May 22, 2007
I set the DataFormatString to {0:d} and also tried {0:MM-dd-yyyy} as several forums and articles suggested; but it still wouldn’t work and kept on displaying the entire string including the time. It turns out, all I had to do is add HtmlEncode=”false”.
<asp:GridView ID=”gridItems” runat=”server” AutoGenerateColumns=”False” DataKeyNames=”ItemId”
DataSourceID=”MyItemsDataSource” Width=”100%”>
<Columns>
<asp:BoundField DataField=”Title” HeaderText=”Title” SortExpression=”Title” />
<asp:BoundField DataField=”Status” HeaderText=”Status” […]
Posted in .net, Web Dev, asp.net
No Comments »
April 10, 2007
I have a sql table that looks like this
Id
Name
Value
1
First name
Bob
1
Last name
Johns
2
First name
John
2
Last name
Smith
3
First name
Bill
3
Last name
Gates
I want to return the data like this:
Id
First name
Last name
1
Bob
Johns
2
John
Smith
3
Bill
Gates
I am completely lost and don’t even know where to start or what to search for… Any ideas?
For the time being, I used code to generate the required results, here it […]
Posted in .net, Programming, SQL
No Comments »