Commenting Out Server Controls in ASP .NET

This is something I seem to be doing an awful as of late. I start out with some control (say a GridView), then switch to some other control (say a Repeater), but I don't want to delete the GridView control until I get the Repeater control working.

You might have tried commenting out the control the HTML way — i.e., <!--...--> — and you probably found out that ASP .NET engine still parses it. Until recently, I was dealing with this the hard way: cutting & pasting the control into Notepad.

No longer.

Enter Server Comments

Namely:

<%--

 <asp:GridView ID="ProductsGridView" runat="server" DataSource="ProductsDataSource">
 </asp:GridView>

--%>

ASP .NET will ignore everything within a server comment block.

One Penny

One Penny Template Screenshot

Feel free to do whatever you want with it as long as it doesn't involve making money off of it. As always, a mention and a link though not required is appreciated very much.

A Wordpress theme based on this template is forthcoming. So stay tuned.

[ View the template ]

[ Download the template files ]

Free Template: Natatorium

Natatorium Template Screenshot

Started out as a tutorial to make tables less boring via applying various formattings and ended up as a template instead. Enjoy. :-D

Look at the template

Download the files

How To Show Some Rows Differently in a GridView

Suppose you're showing a list of customers, and you want to highlight any customer who'd been with you since before 1920. Maybe you also want the JoinedOn field to show the number of months for customers who've been with you for less than a year. It's fairly easy.######Add OnRowDataBound Handler to GridView

The easiest place to change the data is just after the data gets bound to the row. So:


<asp:GridView runat="server" ID="CustomerGrid" OnRowDataBound="CustomerGrid_OnRowDataBound">
</asp:GridView>
Make the changes in CustomerGrid_OnRowDataBound

protected void CustomerGrid_OnRowDataBound(object sender, GridViewRowEventArgs e)
{
 GridViewRow row = e.Row;

 // Make sure we aren't in header/footer rows
 if (row.DataItem == null)
 {
  return;
 }

 Customer customer = row.DataItem as  Customer;

 if (/* Do your conditionals here*/)
 {
  // Change Row formatting here OR
  // Add new cells 
  // Or create an entirely different cells
 }
} 

How do you format a date variable in a GridView?

<asp:BoundField DataField="CreatedOn" DataFormatString="{0:M/dd/yyyy}" HtmlEncode="false" />
######Other Resources:

10 (+ 2) Kick-Ass Wallpapers

From Deviantart.

1. Throb by pixelcatalyst

Screenshot of Throb

Source

2. Falling Rains 2 by preppy

Falling Rains 2

Source

3. Liquid Flower WP by gavinwm

Liquid Flower WP

Source

4. Dreamcatcher by viperv6

Dreamcatcher

Source

5. Nemesis Ovaela by syragon

Nemesis Ovaela

Source

6. Dysphoria by zilla774

Dysphoria

Source

7. Ghostic Widowmaker by zygrael

Ghostic Widowmaker

Source

8. Sylon by viperv6

Sylon

Source

9. Sweet Sugar by sypheck

Sweet Sugar

Source

10. Transfer Section 47 by niteangel

Transfer Section 47

Source

Bonus: convergingDivides by riftfusion

Converging Divides

Source

Bonus 2: Parallel Dimensions by jedeye459

Parallel Dimensions

Source

A Bit More Wordpress

Wordpress Templated Screenshot

Wordpress Templated is, as you might have guessed from the screenshot, a little utility written to make your life better by making theme-creation easier.

For example, if you are anything like me, you can never remember the doctype specification for — wait for it — any doctype. Well, now you don't have to: simply type in "{Doctype type="Xhtml 1.0 Strict"}", click a button, and sit back and watch as you get the doctype url back. On second thought, don't sit back, because you'll surely get frustrated at having to come right back to an upright position. ;-)

Go play with Wordpress Templated

Let me know what you think

Selecting Different Fonts In the Command Prompt Window

I'm working on a side project that makes creating Wordpress themes easier and therefore makes me happier. It's almost ready, but while I procrastinate on putting the finishing touches on the application, let's talk about seeing your command prompt in a completely different light font. Lucida Console is an okay font, but the thing is there are better fonts out there. Turns out that it's really easy to change the default font of the command prompt; though you might get a bad case of jitters at touching the registry. ;-)

1. Open up the registery

Go to Start > Run and type in regedit. This opens up the registery editor. Before doing any changes, we'll be sane and backup our registery. Go to File > Export and give your registery backup an appropriate name. Hopefully, we won't have to use it.

2. Navigate to the Appropriate Entry

Once you're done backuping the registery, navigate to:

HKLM
Software
Microsoft
WindowsNT
CurrentVersion
Console
TrueTypeFont

Where HKLM = "HKEYLOCALMACHINE."

3. Create a new REG_SZ Key

Right-click on the right pane and select New > String Value. Give the new key the name: "00" (or "000" if you already have a "00," and so on...). Microsoft says:

The name needs to be incrimented with "0" for each additional font.

4. Enter the font name

Right-click on your newly-created key and select "Modify". Type in the name of the font you want in the "Value data" box. So for example, if you want the Consolas font, type in "Consolas" (without the quotation marks, of course).

Read the aforementioned Microsoft article on what criteria your fonts should satisfy.

Restart your computer.

5. Set Your Font as the Default Font

Hopefully, you were able to boot up without a problem. Go to the command prompt. Right-click on the title bar and select "Defaults". Go to the "Font" tab. Select your new font in the "Font" section and set the size appropriately. :D

Extra: Set Font For the Current Window Only

Right-click on the title bar and select "Properties" instead of "Defaults". Set the font to whatever and click OK. You'll be asked whether you want to set it for the current window only or save it for all future windows with the same title.

13 of 17 pages « First  <  11 12 13 14 15 >  Last »

On the Side