Sunday, January 29, 2006

Right click command prompt

Here's a handy tip that I got from a co-worker, who found it in the book Microsoft Visual C# .NET Step by Step. It creates a shortcut in the right click context menu of Windows Explorer to open a command prompt in the current directory. When I need to run scripts in a very long directory name, this is very handy.

So here's how you set it up:

Open up windows explorer
Tools -> Folder Options.
File Types Tab
Select the Folder file type
Click Advanced
Click New
For the Action type what ever you want the context menu to display, I used Command Prompt.
For the Application used to perform the action use c:\windows\system32\cmd.exe (note on win2k you will want to specify the winnt directory instead of the windows directory)

You can also use this feature to attach context actions to file types. Or if you want to create a right click open with option for any file type (for instance I like to be able to open any file with notepad, see: my blog entry here.

Friday, January 20, 2006


Well I guess it is time to start being a true programmer and master arrays. So what did I learn day one about using arrays.

If you are going to use C# and want a dynamic array you better use the following code... (HINT USE AN ARRAY LIST)

int i = 0;
ArrayList al = new ArrayList();
while (myReader.Read())
i = i + 1;

Friday, January 13, 2006

Directory .NET Functions

NET Framework Class Library

Directory Members

Moojjoo Blog

SharePoint Stats

Getting Usage Statistics on Sharepoint Portal 2003 Areas
This comes from this microsoft blog

"There are pages available in Windows SharePoint Services that will allow you to obtain usage statistics for WSS Sites. However, this is not the case for Areas in SharePoint Portal Server 2003. There are no built-in hyperlinks in the Admin pages for viewing usage statistics for a give Area.

Does this mean that usage statistics are not available for Areas in SPS 2003? No, it just means that you have to know a backdoor URL to get to the pages that display the stats. Here is the format of the URL:

http://{your portal name}/_layouts/1033/usageDetails.aspx

This URL will take you to a usage statistics page for the Home Area of your portal. (Note: the 1003 is the designator for you language, so it will be different if not using U.S. English).

If you want to look at usage statistics for a Subarea, for instance, News, you would modify the URL to look as follows:

http://{your portal name}/News/_layouts/1033/usageDetails.aspx"

Moojjoo Blog

Wednesday, January 11, 2006

Validating Edits in Grids

When using the Grid Web Controld a lot of times I find myself needing to customize the edit functionality to use validation. The following are the procedures that I use to customize the Data Grid Web Controld.

In order to implement a customization in a datagrid you need to implement a template

<asp:TemplateColumn HeaderText="Gift Amount">
<asp:label id="lblAward_Amount" text='<%# DataBinder.Eval(Container.DataItem, "Gift_Amount", "{0:c}") %>' Runat="server" />
<asp:textbox ID="txtGift_Amount2" text='<%# DataBinder.Eval(Container.DataItem, "Gift_Amount", "{0:c}") %>' runat="server" />
<asp:regularexpressionvalidator id="Regularexpressionvalidator1" runat="server" ControlToValidate="txtGift_Amount2"
ErrorMessage="Money Values only example 20.00 no commas!" ValidationExpression="\d*.\d{2}"></asp:regularexpressionvalidator></asp:boundcolumn>

To access this in the code behind you must using the following:

// This will access the control inside the data grid.
tempGiftAmount = (((TextBox)e.Item.FindControl("txtGift_Amount2")).Text);