<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.1.3" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	>

<channel>
	<title>Daniel Isaacs Díaz Technology Blog</title>
	<link>http://danielisaacs.com</link>
	<description></description>
	<pubDate>Thu, 24 Apr 2008 19:28:40 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.1.3</generator>
	<language>en</language>
			<item>
		<title>Convert a string into an enum</title>
		<link>http://danielisaacs.com/2008/04/24/convert-a-string-into-an-enum/</link>
		<comments>http://danielisaacs.com/2008/04/24/convert-a-string-into-an-enum/#comments</comments>
		<pubDate>Thu, 24 Apr 2008 19:25:21 +0000</pubDate>
		<dc:creator></dc:creator>
		
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://danielisaacs.com/2008/04/24/convert-a-string-into-an-enum/</guid>
		<description><![CDATA[Have you ever come across something like this? I had, and I thought it was something interesting to write about.
The scenario:
I was using the AJAX AutoCompleteExtender when I realized that inside the ServiceMethod of my AutoCompleteExtender, I needed to call   a method that needed between it&#8217;s parameters an Enum.
To the ServiceMethod of an [...]]]></description>
			<content:encoded><![CDATA[<p>Have you ever come across something like this? I had, and I thought it was something interesting to write about.</p>
<p>The scenario:<br />
I was using the AJAX AutoCompleteExtender when I realized that inside the ServiceMethod of my AutoCompleteExtender, I needed to call   a method that needed between it&#8217;s parameters an Enum.</p>
<p>To the ServiceMethod of an AutoCompleteExtender, you can pass parameters through the contextKey.  Nonetheless I couldn&#8217;t pass an enum, so I decided to pass the name of the Database as an string, and then inside the ServiceMethod convert the string into an enum.</p>
<p>Anyways, this is how you convert a string into an enum:<br />
<code><br />
private void Form1_Load(object sender, EventArgs e)<br />
{<br />
DataBase db = convertStringToEnum("Pubs");<br />
MessageBox.Show(db.ToString());<br />
}<br />
private DataBase convertStringToEnum(string dbName)<br />
{<br />
return (DataBase)Enum.Parse(typeof(DataBase), dbName);<br />
}<br />
public enum DataBase<br />
{<br />
Northwind = 0,<br />
Pubs = 1<br />
}<br />
</code></p>
<p>If you have any questions, feel free to leave a comment.</p>
]]></content:encoded>
			<wfw:commentRss>http://danielisaacs.com/2008/04/24/convert-a-string-into-an-enum/feed/</wfw:commentRss>
		</item>
		<item>
		<title>WPF: Add items with multiple columns to a wpf listview</title>
		<link>http://danielisaacs.com/2008/03/03/wpf-add-items-with-multiple-columns-to-a-wpf-listview/</link>
		<comments>http://danielisaacs.com/2008/03/03/wpf-add-items-with-multiple-columns-to-a-wpf-listview/#comments</comments>
		<pubDate>Mon, 03 Mar 2008 21:35:35 +0000</pubDate>
		<dc:creator></dc:creator>
		
		<category><![CDATA[WPF]]></category>

		<guid isPermaLink="false">http://danielisaacs.com/2008/03/03/wpf-add-items-with-multiple-columns-to-a-wpf-listview/</guid>
		<description><![CDATA[In this post I am going to answer some questions concerning my previous WPF post on:ListViewItem in a ListView
In my previous post, I had a WPF ListView that displayed two items, and each item occupied one row and one column.

But what if I would like to add an item to a WPF ListView but this [...]]]></description>
			<content:encoded><![CDATA[<p>In this post I am going to answer some questions concerning my previous WPF post on:<a href="http://danielisaacs.com/2007/08/01/wpf-listviewitem-in-a-listview/">ListViewItem in a ListView</a></p>
<p>In my previous post, I had a WPF ListView that displayed two items, and each item occupied one row and one column.<br />
<img src="http://www.danielisaacs.com/images/listview2.bmp" /></p>
<p>But what if I would like to add an item to a WPF ListView but this time that one row contains more than one column.  In this way we can answer questions such as: &#8220;How to add a ListView item in two columns using c# code&#8221;.  If this is the question you are looking to answer, you have found just what you were looking for.  I will show you how to do the following in Visual Studio 2008:</p>
<p><strong>Window1.xaml</strong></p>
<p>&lt;Window x:Class=&#8221;ListViewProj.Window1&#8243;<br />
xmlns=&#8221;http://schemas.microsoft.com/winfx/2006/xaml/presentation&#8221;<br />
xmlns:x=&#8221;http://schemas.microsoft.com/winfx/2006/xaml&#8221;<br />
Title=&#8221;Window1&#8243; Height=&#8221;220&#8243; Width=&#8221;285&#8243;&gt;<br />
&lt;Grid&gt;<br />
&lt;ListView Margin=&#8221;11,16,35,17&#8243; Name=&#8221;listView1&#8243; /&gt;<br />
&lt;/Grid&gt;<br />
&lt;/Window&gt;</p>
<p><strong>Window1.xaml.cs</strong><br />
<code><br />
public partial class Window1 : Window<br />
{<br />
public Window1()<br />
{<br />
InitializeComponent();<br />
// The constructor accepts a first name, last name, major<br />
Student student = new Student("Daniel","Isaacs","Computer Science");<br />
ObservableCollection<student> &lt;studentObj&gt; = new ObservableCollection<student>();<br />
// add a student<br />
studentObj.Add(student);</student></student><br />
// displays data items in columns for a ListView<br />
GridView gView = new GridView();<br />
// set the first gridview column<br />
GridViewColumn firstCol = new GridViewColumn();<br />
// set the data item to bind to for this column<br />
firstCol.DisplayMemberBinding = new Binding(&#8221;FirstName&#8221;);<br />
firstCol.Header = &#8220;First Name&#8221;;<br />
// set the second gridview column<br />
GridViewColumn secondCol = new GridViewColumn();<br />
secondCol.DisplayMemberBinding = new Binding(&#8221;LastName&#8221;);<br />
secondCol.Header = &#8220;Last Name&#8221;;<br />
// set the third gridview column<br />
GridViewColumn thirdCol = new GridViewColumn();<br />
thirdCol.DisplayMemberBinding = new Binding(&#8221;Major&#8221;);<br />
thirdCol.Header = &#8220;Major&#8221;;<br />
// add gridview columns<br />
gView.Columns.Add(firstCol);<br />
gView.Columns.Add(secondCol);<br />
gView.Columns.Add(thirdCol);<br />
// set the collection that is going to be used to generate content<br />
listView1.ItemsSource = studentObj;<br />
// sets how data is organized and styled<br />
listView1.View = gView;<br />
}<br />
}<br />
</code></p>
<p>In the XAML code I only added a ListView.  In the code behind I created an instance of the Student class (a class I created for this example).  Then I add the instance of the student class to the collection that is going to be used to generate content.  </p>
<p>I also created an instance of the GridView class, because the gridview is how we are going to organized the data.  After this I create three instances of the GridViewColumn class(you can created as many instances of the GridViewColumn as you need).  Each GridViewColumn needs a binding (DisplayMemberBinding) which sets the data item to bind to for this column.  </p>
<p>Don&#8217;t forget to add the GridViewColumn to the GridView. At the end assign to the listView ItemSource Property the collection with the content, and assign to the listview View Property the Gridview instance.</p>
<p><img src="http://www.danielisaacs.com/images/listview-with-columns.bmp" /></p>
<p>Here’s a copy of <a href="http://www.danielisaacs.com/examples/ListViewProj.zip">my files.</a></p>
<p>If you have any comments or questions just let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://danielisaacs.com/2008/03/03/wpf-add-items-with-multiple-columns-to-a-wpf-listview/feed/</wfw:commentRss>
		</item>
		<item>
		<title>ASP.NET AJAX AutoComplete extender</title>
		<link>http://danielisaacs.com/2008/02/13/aspnet-ajax-autocomplete-extender/</link>
		<comments>http://danielisaacs.com/2008/02/13/aspnet-ajax-autocomplete-extender/#comments</comments>
		<pubDate>Wed, 13 Feb 2008 01:48:28 +0000</pubDate>
		<dc:creator></dc:creator>
		
		<category><![CDATA[ASP.NET]]></category>

		<guid isPermaLink="false">http://danielisaacs.com/2008/02/13/aspnet-ajax-autocomplete-extender/</guid>
		<description><![CDATA[When you go to Yahoo, if you start typing in their web search, after you type several words, you end up with a window that has several options according to the search string you just entered.  I was trying to simulate that effect in an asp.net webpage.
To do this I decided to use the [...]]]></description>
			<content:encoded><![CDATA[<p>When you go to Yahoo, if you start typing in their web search, after you type several words, you end up with a window that has several options according to the search string you just entered.  I was trying to simulate that effect in an asp.net webpage.</p>
<p>To do this I decided to use the ASP.NET AJAX TOOLKIT.  I am using Visual Web Developer 2008 Express to do this, I created a new website, and started working from here.</p>
<p>To accomplish this you will need to:</p>
<p><strong>1- Add the AjaxControlToolkit.dll to your project</strong>(Add reference -&gt; Browse tab ).  When you download the tookit you can search for this dll, and you should be able to find it.<br />
(I found mine in this path: Visual Studio 2005\Templates\ProjectTemplates\Visual C#\AjaxControlExtenderProjectCS\AjaxControlToolkit.dll)<br />
<strong>2- Add a webform to your project<br />
3- Add a web service to your project<br />
4- Add a style sheet to your project</strong></p>
<p><strong>The Webform</strong>:<br />
I will proceed to explain several parts of the webform</p>
<p>Before the HTML you need to register the Ajax Control Toolkit custom control.<br />
<strong>&lt;%@ Register<br />
Assembly=&#8221;AjaxControlToolkit&#8221;<br />
Namespace=&#8221;AjaxControlToolkit&#8221;<br />
TagPrefix=&#8221;ajaxToolkit&#8221; %&gt;</strong></p>
<p>Don&#8217;t forget to add the style sheet we are using.<br />
<strong>&lt;link href=&#8221;StyleSheet.css&#8221; rel=&#8221;stylesheet&#8221; type=&#8221;text/css&#8221; /&gt;</strong></p>
<p>Inside the form I have the following:<br />
First, I start adding a toolkit script manager:<br />
<strong>&lt;ajaxtoolkit:toolkitscriptmanager runat=&#8221;server&#8221; id=&#8221;ScriptManager1&#8243;/&gt;</strong><br />
If you don&#8217;t do this you might get an error that says &#8220;The control with ID &#8216;AutoComplete1&#8242; requires a ScriptManager on the page. The ScriptManager must appear before any controls that need it.&#8221;.  The reason you need it (as I understand it) is that the toolkit script manager merges multiple javascript scripts into one file, which is downloaded at runtime.</p>
<p>Then, you need a textbox, which is where your search is going to be typed.<br />
<strong>&lt;asp:textbox runat=&#8221;server&#8221; id=&#8221;txtInput&#8221; width=&#8221;300&#8243;/&gt;</strong></p>
<p>Of course, you need to add in the form the ASP.NET AJAX AutoComplete Extender.  According to the asp.net webpage this extender:&#8221;can be attached to any TextBox control, and will associate that control with a popup panel to display words that begin with the prefix typed into the textbox.&#8221;.  This is how the extender looks in my form:<br />
<strong>&lt;ajaxToolkit:AutoCompleteExtender<br />
runat=&#8221;server&#8221;<br />
ID=&#8221;AutoComplete1&#8243;<br />
TargetControlID =&#8221;txtInput&#8221;<br />
ServiceMethod=&#8221;GetCustomersContactTitle&#8221;<br />
ServicePath=&#8221;WebService.asmx&#8221;<br />
MinimumPrefixLength=&#8221;2&#8243;<br />
CompletionInterval=&#8221;1000&#8243;<br />
EnableCaching=&#8221;true&#8221;<br />
CompletionSetCount=&#8221;20&#8243;<br />
CompletionListCssClass=&#8221;flyout-background&#8221;<br />
CompletionListItemCssClass=&#8221;flyout-item&#8221;<br />
CompletionListHighlightedItemCssClass=&#8221;flyout-item-hover&#8221;&gt;<br />
&lt;/ajaxToolkit:AutoCompleteExtender&gt;</strong></p>
<p>This is what the webform needs, nonetheless, this is very basic, because my purpose is to show how this works, and that you can also understand what everything means.</p>
<p>Now, I am going to write about the two most important parts of <strong>the webservice</strong> :</p>
<p>First, make sure this line is commented when you add your Webservice.  This line needs to be uncommented, since you need to call the webservice from your webform.<br />
<strong> // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.<br />
[System.Web.Script.Services.ScriptService]</strong></p>
<p>Last but not least, you need a method that returns the data to be displayed.  My method basically gets the ContactTitle Column in the Customers table which is located in the Northwind database.  I used this database since it is available to everyone. The AJAX AutoComplete Extender requires that the method that you use to display data, matches the following signature: a method that returns an array of strings, and has two parameters, which is the prefix the user just entered, and the amount of records to be displayed.</p>
<p><code><br />
[WebMethod]<br />
public string[] GetCustomersContactTitle(string prefixText, int count)<br />
{<br />
List&lt;string&gt; items = new List&lt;string&gt;(count);<br />
DataSet ds = new DataSet();string connectionString = "Data Source=(local);Initial Catalog=Northwind;Integrated Security=SSPI;";<br />
using(SqlConnection connection = new SqlConnection(connectionString))<br />
{<br />
string sql = "SELECT ContactTitle FROM Customers WHERE ContactTitle LIKE '" + prefixText + "%'";<br />
SqlDataAdapter adapter = new SqlDataAdapter();<br />
adapter.SelectCommand = new SqlCommand(sql,connection);<br />
adapter.Fill(ds);<br />
}<br />
foreach (DataRow dr in ds.Tables[0].Rows)<br />
{<br />
items.Add(dr["ContactTitle"].ToString());<br />
}<br />
return items.ToArray();<br />
}<br />
</code></p>
<p>Finally, the stylesheet, to have a better understanding on the CSS Classes I would recommend that you play with them, so you have a better understanding on what they do.  Nonetheless, I provided a description of what they do.</p>
<p>This class is going to be applied to the completion list flyout.<br />
<strong>.flyout-background {<br />
border: 1px solid #009;<br />
list-style-type: none;<br />
margin: 0px;<br />
background-color: #FFFFFF;<br />
text-align: left;<br />
}<br />
</strong></p>
<p>This class is going to be applied to an item in the AutoComplete list flyout.<br />
<strong>.flyout-item {<br />
color: #FF0000;<br />
}</strong></p>
<p>This class is going to be applied to a highlighted item in the AutoComplete list flyout.<br />
<strong>.flyout-item-hover {<br />
background-color: #66FFFF;<br />
}<br />
</strong></p>
<p>This is the final result:<br />
<img src="http://www.danielisaacs.com/images/asp-net-ajax-autocomplete.bmp" /></p>
<p>Here&#8217;s a <a href="http://www.danielisaacs.com/examples/ASP-NET%20Ajax%20Extender.zip">copy of my files</a></p>
<p>If you have any comments just let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://danielisaacs.com/2008/02/13/aspnet-ajax-autocomplete-extender/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The device, \Device\Harddisk0, has a bad block</title>
		<link>http://danielisaacs.com/2008/02/02/the-device-deviceharddisk0-has-a-bad-block/</link>
		<comments>http://danielisaacs.com/2008/02/02/the-device-deviceharddisk0-has-a-bad-block/#comments</comments>
		<pubDate>Sat, 02 Feb 2008 04:01:07 +0000</pubDate>
		<dc:creator></dc:creator>
		
		<category><![CDATA[Troubleshooting]]></category>

		<guid isPermaLink="false">http://danielisaacs.com/2008/02/02/the-device-deviceharddisk0-has-a-bad-block/</guid>
		<description><![CDATA[I am currently using a computer with a Windows 2003 Server Operating System.  It took me about 15 minutes to get to the login screen.  When I was finally able to log into my profile, I checked the Event Viewer and saw the following error:
The device, \Device\Harddisk0, has a bad block.
I was able [...]]]></description>
			<content:encoded><![CDATA[<p>I am currently using a computer with a Windows 2003 Server Operating System.  It took me about 15 minutes to get to the login screen.  When I was finally able to log into my profile, I checked the Event Viewer and saw the following error:</p>
<p>The device, \Device\Harddisk0, has a bad block.</p>
<p>I was able to fix this doing the following:</p>
<ul>
<li>Do a right click on your C: drive.</li>
<li>Select properties</li>
<li>Click on the Tools tab, in the Error-Checking section click the &#8220;Check Now&#8221; button.</li>
<p><img src="http://www.danielisaacs.com/images/error-checking.JPG" alt="Error-Checking" /></ul>
<ul>
<li>Select all the Check disc options and press start.</li>
<p><img src="http://www.danielisaacs.com/images/check-disk.JPG" /></ul>
<p>After I did all this I got the following message: &#8220;The disk check could not be performed because the disk check utility needs exclusive access to some Windows files on the disk.  These files can be accessed only by restarting Windows.  Do you want to schedule this disk check to occur the next time you restart the computer?&#8221; press &#8220;Yes&#8221; and the next time you restart your computer a CHKDSK (Checkdisk) is going to be performed.  This fixed my problem.</p>
<p>If you have another way of fixing this problem, please let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://danielisaacs.com/2008/02/02/the-device-deviceharddisk0-has-a-bad-block/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Reading folder names from a folder in C#</title>
		<link>http://danielisaacs.com/2007/12/19/reading-folder-names-from-a-folder-in-c/</link>
		<comments>http://danielisaacs.com/2007/12/19/reading-folder-names-from-a-folder-in-c/#comments</comments>
		<pubDate>Wed, 19 Dec 2007 22:07:30 +0000</pubDate>
		<dc:creator></dc:creator>
		
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://danielisaacs.com/2007/12/19/reading-folder-names-from-a-folder-in-c/</guid>
		<description><![CDATA[Another easy but useful task: Read the names of different folders that are inside a directory.  Reading the names is easy, but splitting the absolute path of the directory to only get the name of the folder, is a little bit more interesting.
I am using ASP.NET to do this:
Default.aspx
&#60;form id=”form1″ runat=”server”&#62;
&#60;asp:listbox id=”ListBox1″ runat=”server”&#62;&#60;/asp:listbox&#62;
&#60;/form&#62;
I just [...]]]></description>
			<content:encoded><![CDATA[<p>Another easy but useful task: Read the names of different folders that are inside a directory.  Reading the names is easy, but splitting the absolute path of the directory to only get the name of the folder, is a little bit more interesting.</p>
<p>I am using ASP.NET to do this:</p>
<p>Default.aspx</p>
<p>&lt;form id=”form1″ runat=”server”&gt;<br />
&lt;asp:listbox id=”ListBox1″ runat=”server”&gt;&lt;/asp:listbox&gt;<br />
&lt;/form&gt;</p>
<p>I just declare a listbox inside the form.</p>
<p>Default.aspx.cs<br />
<code><br />
public partial class _Default : System.Web.UI.Page<br />
{<br />
protected void Page_Load(object sender, EventArgs e)<br />
{<br />
foreach (string subDirectory in<br />
System.IO.Directory.GetDirectories(<br />
AppDomain.CurrentDomain.BaseDirectory))<br />
{<br />
// split the folders into an array of strings<br />
string[] directory = subDirectory.Split(new char[] { '\\' });<br />
// how many folders do we have?<br />
int numOfDirectories = directory.Length;<br />
// the last folder is the folder we are looking for<br />
ListBox1.Items.Add(directory[numOfDirectories - 1]);<br />
}<br />
}<br />
}<br />
</code></p>
<p><strong>System.IO.Directory.GetDirectories</strong> as MSDN states: &#8220;Gets the names of subdirectories in the specified directory&#8221;.  However, you get an absolute path of the directory.</p>
<p>If you would like to add the name of the folder to a listbox you will need to split the string that contains the different directories and store the directories in an array of strings:</p>
<p>string[] directory = subDirectory.Split(new char[] { &#8216;\\&#8217; });</p>
<p>After this step, you get the amount of directories the absolute path has, and then look for the last directory in the array:</p>
<p>int numOfDirectories = directory.Length;<br />
ListBox1.Items.Add(directory[numOfDirectories - 1]);</p>
<p>The directory I am using to read the files is <strong>AppDomain.CurrentDomain.BaseDirectory</strong> which is the base directory that the assembly resolver uses to search for assemblies.</p>
<p>The result of this snippet is:<br />
<img src="http://www.danielisaacs.com/images/directories-listbox.bmp" /></p>
]]></content:encoded>
			<wfw:commentRss>http://danielisaacs.com/2007/12/19/reading-folder-names-from-a-folder-in-c/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Sort an array of strings in C#</title>
		<link>http://danielisaacs.com/2007/12/18/sort-an-array-of-strings-in-c/</link>
		<comments>http://danielisaacs.com/2007/12/18/sort-an-array-of-strings-in-c/#comments</comments>
		<pubDate>Tue, 18 Dec 2007 02:44:58 +0000</pubDate>
		<dc:creator></dc:creator>
		
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://danielisaacs.com/2007/12/18/sort-an-array-of-strings-in-c/</guid>
		<description><![CDATA[The task: You have a string that is comma delimited , and you would like to sort that string and display it in a listbox.
I am using ASP.NET to do this:
Default.aspx
&#60;form id=&#8221;form1&#8243; runat=&#8221;server&#8221;&#62;
&#60;asp:listbox id=&#8221;ListBox1&#8243; runat=&#8221;server&#8221;&#62;&#60;/asp:listbox&#62;
&#60;/form&#62;
I just declare a listbox inside the form.
Default.aspx.cs

public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
// the comma delimited [...]]]></description>
			<content:encoded><![CDATA[<p>The task: You have a string that is comma delimited , and you would like to sort that string and display it in a listbox.</p>
<p>I am using ASP.NET to do this:</p>
<p>Default.aspx</p>
<p>&lt;form id=&#8221;form1&#8243; runat=&#8221;server&#8221;&gt;<br />
&lt;asp:listbox id=&#8221;ListBox1&#8243; runat=&#8221;server&#8221;&gt;&lt;/asp:listbox&gt;<br />
&lt;/form&gt;</p>
<p>I just declare a listbox inside the form.</p>
<p>Default.aspx.cs<br />
<code><br />
public partial class _Default : System.Web.UI.Page<br />
{<br />
protected void Page_Load(object sender, EventArgs e)<br />
{<br />
// the comma delimited list<br />
string names = "Lesseps,Daniel,Isaacs,Diaz";<br />
// split the string and make it an array of strings<br />
string[] listOfNames = names.Split(new char[] { ',' });<br />
// sort the array of strings<br />
Array.Sort(listOfNames);<br />
foreach (string name in listOfNames)<br />
{<br />
ListBox1.Items.Add(name);<br />
}<br />
}<br />
}<br />
</code><br />
The result:<br />
<img src="http://www.danielisaacs.com/images/sort-array-of-strings.bmp" alt="sort an array of strings" /></p>
<p>In C#, it is extremely easy to sort an array of strings, just use:</p>
<p>Array.Sort(listOfNames);</p>
<p>where listOfNames is an array of strings.</p>
]]></content:encoded>
			<wfw:commentRss>http://danielisaacs.com/2007/12/18/sort-an-array-of-strings-in-c/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Installing ASP.NET 2.0 WebService Extensions</title>
		<link>http://danielisaacs.com/2007/11/06/installing-aspnet-20-webservice-extensions/</link>
		<comments>http://danielisaacs.com/2007/11/06/installing-aspnet-20-webservice-extensions/#comments</comments>
		<pubDate>Tue, 06 Nov 2007 04:19:27 +0000</pubDate>
		<dc:creator></dc:creator>
		
		<category><![CDATA[ASP.NET]]></category>

		<guid isPermaLink="false">http://danielisaacs.com/2007/11/06/installing-aspnet-20-webservice-extensions/</guid>
		<description><![CDATA[I am using Windows Server 2003 for some development on some ASP.NET 2.0 projects. However, when I tried to compile my first project I had an error that said: 
&#8220;This product requires ASP.Net web service extensions to be enabled in Internet Information Services (IIS)&#8221;.
I went into my Administrative Tools-> Internet Information Services (IIS) Manager, and [...]]]></description>
			<content:encoded><![CDATA[<p>I am using Windows Server 2003 for some development on some ASP.NET 2.0 projects. However, when I tried to compile my first project I had an error that said: </p>
<p>&#8220;This product requires ASP.Net web service extensions to be enabled in Internet Information Services (IIS)&#8221;.</p>
<p>I went into my Administrative Tools-> Internet Information Services (IIS) Manager, and I didn&#8217;t find my Web Service Extension for ASP.NET 2.0. Consequently, I had to install asp.net (2.0.50727) WebService Extensions. </p>
<p>In order to do this, I used a command prompt and went to: </p>
<p>C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727. </p>
<p>In that directory I typed: </p>
<p>aspnet_regiis -i </p>
<p>After this you should see in your command prompt something that says like this: &#8220;Start installing ASP.NET (2.0.50727)&#8221;. After the extensions are installed you should see something like this: &#8220;Finished installing ASP.NET (2.0.50727)&#8221;. At this point, this error should be solved, and your ASP.NET 2.0 WebService Extensions should be installed.</p>
]]></content:encoded>
			<wfw:commentRss>http://danielisaacs.com/2007/11/06/installing-aspnet-20-webservice-extensions/feed/</wfw:commentRss>
		</item>
		<item>
		<title>C#: Show a User Control</title>
		<link>http://danielisaacs.com/2007/09/01/show-a-user-control/</link>
		<comments>http://danielisaacs.com/2007/09/01/show-a-user-control/#comments</comments>
		<pubDate>Sat, 01 Sep 2007 20:51:40 +0000</pubDate>
		<dc:creator></dc:creator>
		
		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://danielisaacs.com/2007/09/01/show-a-user-control/</guid>
		<description><![CDATA[This is the case scenario: if you have a form and in the form you have a button, if you press the button can you actually see a User Control displayed?.  A friend of mine asked me this question because in his form he was trying to display a user control doing this:

private void [...]]]></description>
			<content:encoded><![CDATA[<p>This is the case scenario: if you have a form and in the form you have a button, if you press the button can you actually see a User Control displayed?.  A friend of mine asked me this question because in his form he was trying to display a user control doing this:<br />
<code><br />
private void button1_Click(object sender, EventArgs e)<br />
{<br />
UserControl1 userControl = new UserControl1();<br />
userControl.Show();<br />
}<br />
</code><br />
This will not do the trick.  What you need to do is to create a form,  add the user control to the form, and then display the form.  This is a simple way of doing this:<br />
<code><br />
public partial class Form1 : Form<br />
{<br />
public Form1()<br />
{<br />
InitializeComponent();<br />
}<br />
public void Show(Control control)<br />
{<br />
Form form = new Form();<br />
form.Controls.Add(control);<br />
form.Show();<br />
}<br />
private void button1_Click(object sender, EventArgs e)<br />
{<br />
UserControl1 userControl = new UserControl1();<br />
Form1 form = new Form1();<br />
form.Show(userControl);<br />
}<br />
}<br />
</code><br />
At this point you will be able to see your user control displayed inside a form.</p>
]]></content:encoded>
			<wfw:commentRss>http://danielisaacs.com/2007/09/01/show-a-user-control/feed/</wfw:commentRss>
		</item>
		<item>
		<title>LINQ: a quick start</title>
		<link>http://danielisaacs.com/2007/08/25/linq-a-quick-start/</link>
		<comments>http://danielisaacs.com/2007/08/25/linq-a-quick-start/#comments</comments>
		<pubDate>Sat, 25 Aug 2007 20:08:24 +0000</pubDate>
		<dc:creator></dc:creator>
		
		<category><![CDATA[LINQ]]></category>

		<guid isPermaLink="false">http://danielisaacs.com/2007/08/25/linq-a-quick-start/</guid>
		<description><![CDATA[If you want a basic quick start in LINQ this is going to help you.
LINQ according to the research I did in MSDN is a &#8220;set of extensions to the .NET Framework that encompass language-integrated query, set, and transform operations.&#8221; In MSDN they define LINQ in simple terms, and state that &#8220;LINQ is a series [...]]]></description>
			<content:encoded><![CDATA[<p>If you want a basic quick start in LINQ this is going to help you.</p>
<p>LINQ according to the research I did in MSDN is a &#8220;set of extensions to the .NET Framework that encompass language-integrated query, set, and transform operations.&#8221; In MSDN they define LINQ in simple terms, and state that &#8220;LINQ is a series of language extensions that supports data querying in a type-safe way&#8221;.  The last interesting fact I found in MSDN about LINQ is that &#8220;the data to be queried can take the form of XML, databases, objects, and so on&#8221;.</p>
<p>There&#8217;s a lot of theory about LINQ in MSDN and in the internet, but my purpose is to give you a quick start in how to start coding LINQ applications.</p>
<p>The first step is to download the &#8220;Language Interated Query, May 2006 Community Technology Preview&#8221;.  The link to this preview is <a href="http://www.microsoft.com/downloads/details.aspx?familyid=1e902c21-340c-4d13-9f04-70eb5e3dceea&amp;displaylang=en">here</a>.</p>
<p>The importance of installing this extension is that if you go to Visual Studio 05, and  press File-&gt;New-&gt;Project , you will see in your Visual C# tree a node that says &#8220;LINQ Preview&#8221; which will give you the option to create a LINQ Console Application, LINQ Windows Application, LINQ Library, and LINQ WinFX Application.</p>
<p><img src="http://www.danielisaacs.com/images/linq-preview.bmp" /></p>
<p>For this introduction I&#8217;m going to choose a LINQ Windows Application. When a LINQ Windows Application is created you will be able to see DLL&#8217;s needed for LINQ applications such as: System.Data.DLinq, System.Data.Extensions, System.Query, System.Xml.XLinq.</p>
<p>Now that you have your LINQ Windows Application created, the task will be the following:<br />
Display an array of strings ordered alphabetically in a listbox.</p>
<p>This is how you can do this:<br />
<code><br />
private void Form1_Load(object sender, EventArgs e)<br />
{<br />
string[] names = { "Daniel", "Lesseps", "Isaacs", "Diaz" };<br />
var namesToDisplay = from name in names<br />
orderby name<br />
select name;<br />
foreach(var name in namesToDisplay)<br />
listBox1.Items.Add(name);<br />
}<br />
</code><br />
When our form loads the first line declares an array of strings that contains 4 words.</p>
<p>The next line is a sample LINQ query, and I will explain this line as I understand it (which means that if you have any input on my explanation it will be appreciated) .  As you can see LINQ queries start with &#8220;var&#8221; which indicates it&#8217;s a local variable.  The LINQ query contains clauses like: FROM, WHERE, SELECT,ORDERBY, GROUP BY, and others.  This example starts with &#8220;from name in names&#8221;. The part &#8220;in names&#8221; is very important since it&#8217;s specifying the list that is going to be queried.  After this I&#8217;m ordering the names alphabetically using &#8220;orderby name&#8221;.  The last line of the query is the &#8220;select name(you can think of name as the name of my column)&#8221;.  SQL queries start with the SELECT clause; however, LINQ queries end with the SELECT clause.<br />
<code><br />
var namesToDisplay = from name in names<br />
orderby name<br />
select name;</code></p>
<p>After this we iterate the results of the query using a foreach, and each statement returns a name.</p>
<p><img src="http://www.danielisaacs.com/images/linq-listbox.bmp" /></p>
<p>As you can see, SQL queries can now be integrated in C#.<br />
Very interesting! This is a basic example,I will write more complex examples later on.</p>
]]></content:encoded>
			<wfw:commentRss>http://danielisaacs.com/2007/08/25/linq-a-quick-start/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Bug: DataGridViewCell adding itself</title>
		<link>http://danielisaacs.com/2007/08/18/datagridviewcell-adding-itself/</link>
		<comments>http://danielisaacs.com/2007/08/18/datagridviewcell-adding-itself/#comments</comments>
		<pubDate>Sat, 18 Aug 2007 16:00:36 +0000</pubDate>
		<dc:creator></dc:creator>
		
		<category><![CDATA[Bug]]></category>

		<guid isPermaLink="false">http://danielisaacs.com/2007/08/18/datagridviewcell-adding-itself/</guid>
		<description><![CDATA[If you run the code below you will notice the following behavior:
For some reason when I press a button and the button puts an error text in my cell (because of an error validation) when I go back to the cell, it selects all the text in the datagridviewcell and if you press a number [...]]]></description>
			<content:encoded><![CDATA[<p>If you run the code below you will notice the following behavior:</p>
<p>For some reason when I press a button and the button puts an error text in my cell (because of an error validation) when I go back to the cell, it selects all the text in the datagridviewcell and if you press a number you are going to be able to watch two behaviors:</p>
<p>1- The Datagridviewcell adds itself:<br />
This was happening in my real world application.<br />
For example, if I have a number like 1111.000 (let&#8217;s say this sends a validation error), if you go back to the cell and press &#8220;1&#8243; you will see something like<br />
1111.001<br />
If you press &#8220;5&#8243; you will see something like<br />
1111.002<br />
If you keep pressing numbers you will see that you will be adding your current number.</p>
<p>2- The Datagridviewcell will only let you put one number at a time.<br />
This is what happens in the code below. If you press 1111.000 and you go back to the cell and press &#8220;1&#8243; you will see something like<br />
1.000<br />
<img src="http://www.danielisaacs.com/images/1.bmp" /><br />
If you press &#8220;2&#8243; instead of being 12.000 or 1.002 you will see<br />
2.000<br />
<img src="http://www.danielisaacs.com/images/2.bmp" /><br />
It will only let you put one number at a time.</p>
<p>Here&#8217;s the code for this scenario</p>
<p><code><br />
using System;<br />
using System.Collections.Generic;<br />
using System.ComponentModel;<br />
using System.Data;<br />
using System.Drawing;<br />
using System.Text;<br />
using System.Windows.Forms;<br />
using System.Text.RegularExpressions;<br />
namespace DataGridViewBugBlog<br />
{<br />
public partial class Form1 : Form<br />
{<br />
public Form1()<br />
{<br />
InitializeComponent();<br />
}<br />
private void Form1_Load(object sender, EventArgs e)<br />
{<br />
InitializeGridColumns();<br />
FormatDataGridColumn(dataGridView1, "Price", typeof(double), null);<br />
}<br />
private void InitializeGridColumns()<br />
{<br />
DataSet ds = new DataSet();<br />
DataTable dt = new DataTable();<br />
ds.Tables.AddRange(new System.Data.DataTable[] {dt});<br />
// Adding columns to the DataTable<br />
dt.Columns.Add("Quantity", typeof(double));<br />
dt.Columns.Add("Price", typeof(double));<br />
dataGridView1.DataSource = ds.Tables[0].DefaultView;<br />
// Setting the width of both columns<br />
foreach (DataGridViewColumn col in dataGridView1.Columns)<br />
col.Width = 95;<br />
}<br />
private void button1_Click(object sender, EventArgs e)<br />
{<br />
showConfirmation();<br />
}<br />
/// <summary><br />
/// If the price or quantity doesn&#8217;t have a correct<br />
/// format it will send a messagebox.<br />
/// </summary><br />
private void showConfirmation()<br />
{<br />
bool error = false;<br />
foreach (DataGridViewRow mRow in this.dataGridView1.Rows)<br />
if (!ValidateData(mRow))<br />
error = true;<br />
if (error)<br />
MessageBox.Show(&#8221;Invalid quantity or price, please check and reenter&#8221;, &#8220;Errors&#8221;, MessageBoxButtons.OK, MessageBoxIcon.Error);<br />
return;<br />
}<br />
/// <summary><br />
/// The valid format for the price<br />
/// is 000,0000<br />
/// </summary><br />
private bool ValidateData(DataGridViewRow mRow)<br />
{<br />
bool ok = true;<br />
string txtPrice = &#8220;Price&#8221;;<br />
//quantity format<br />
if (!Regex.IsMatch(mRow.Cells[txtPrice].FormattedValue.<br />
ToString(), @&#8221;(?!^0*$)(?!^0*\.0*$)^\d{1,3}(\.\d{1,4})?$&#8221;))<br />
mRow.Cells[txtPrice].ErrorText = &#8220;Please enter a valid numeric format. Ex (000,0000) &#8220;;<br />
ok = false;<br />
return ok;<br />
}<br />
/// <summary><br />
/// This event handler manually raises the CellValueChanged event<br />
/// by calling the CommitEdit method. The event CellValueChanged<br />
/// was used to handle DataGridViewCheckBoxCell logic.<br />
/// </summary><br />
private void dataGridView1_CurrentCellDirtyStateChanged(object sender, EventArgs e)<br />
{<br />
if (dataGridView1.IsCurrentCellDirty &amp;&amp; dataGridView1.CurrentCell.ColumnIndex &gt;= dataGridView1.Columns[&#8221;Price&#8221;].Index)<br />
dataGridView1.<br />
CommitEdit(DataGridViewDataErrorContexts.Commit);<br />
}<br />
internal static void FormatDataGridColumn(DataGridView dataGrid, string col, Type type,<br />
string format)<br />
{<br />
DataGridViewColumn column = dataGrid.Columns[col];<br />
if (type == typeof(Double))<br />
column.DefaultCellStyle.Format = format == null ? &#8220;##0.0000&#8243; : format;<br />
}<br />
private void dataGridView1_CellEnter(object sender, DataGridViewCellEventArgs e)<br />
{<br />
dataGridView1.EditMode = DataGridViewEditMode.EditOnEnter;<br />
}<br />
}<br />
}<br />
</code></p>
<p>This only an excerpt of my code.  The interesting part about this, is that what causes this error is the CurrentCellDirtyStateChanged event.  I had this event because inside of it i had a CommitEdit method that raises the CellValueChanged event in which I was changing the values of some DataGridViewCheckBoxCell.</p>
<p>The solution:<br />
Make sure in the CurrentCellDirtyStateChanged the CommitEdit is only made when you are in a DataGridViewCheckBoxCell.  For the code above just comment the CommitEdit method and it will work like it should.</p>
]]></content:encoded>
			<wfw:commentRss>http://danielisaacs.com/2007/08/18/datagridviewcell-adding-itself/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
