C# String Formating

August 2, 2008

String formating is pretty easy task in C# or ASP.NET

To format date you use:
{0:d}

To format numers to contains semicolon as thousand separator you use:
{0:n}

The easiet way to format a string is to use String.Format method.

How to strip html tags from text in PHP

August 2, 2008

Recently I faced small problem when working for one of my clients. He stores html tags in database:

<font color="00ff00">Some text</font>

 

I need quick and dirty solution, so I decided to use php function strip_tags()

This function removes all html text leaving only text, this was exactly what I need.

The final code look like this:

$text = strip_tags('Text‘);

Modal Popup in Ajax Control Toolkit display onload

May 3, 2008

There is a small bug in AjaxControlToolkit when you will add Modal Popup Control Extender,

it is being shown for one second when page is being load. It is not a big issue, but it can be very annoying.

Below file shows the proeblem and the resolution. Resolution is very simple, you just need to add
style=”display:none” to ModalPanel control.

 

<asp :Panel runat="server" ID="ModalPanel" CssClass="modalPopup">
        <asp :Label runat="server" ID="ModalLabel" Text="Modal Panel Label" />
        <br /><br />
        <asp :Button runat="server" ID="OkButton" Text="Ok" />
    </asp>
    <cc1 :ModalPopupExtender ID="ModalPopupExtender1" runat="server"
        PopupControlID="ModalPanel" DropShadow="true" TargetControlID="ShowButton"
        OkControlID="OkButton" BackgroundCssClass="modalBackground" >
    </cc1>

Get the Flash Player to see this player.