Feeds:
Posts
Comments

Archive for the ‘ASP’ Category

IsDate in ASP.NET

public static bool IsDate(Object obj)
{
        string strDate = obj.ToString();
        try
        {
            DateTime dt = DateTime.Parse(strDate);
            if((dt.Month!=System.DateTime.Now.Month) || (dt.Day<1&&dt.Day>31) || dt.Year!=System.DateTime.Now.Year)
                return false;
            else
                return true;
       }
       catch
       {
            return false;
       }
}

Advertisements

Read Full Post »

IsNumeric in ASP.NET

public static bool IsNumeric(object value)
{
        try
        {
            int i = Convert.ToInt32(value.ToString());
            return true;
        }
        catch (FormatException)   
        {
            return false;
        }
}

Read Full Post »

isGuid in ASP.NET

static bool isGuid(string guid)
{
bool isValid = false;
Regex re = new Regex(@”^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\- [0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\- [0-9a-fA-F]{12}(\}){0,1}$”, RegexOptions.IgnoreCase);
if (re.IsMatch(guid))
{
isValid = true;
}
return isValid;
}

Read Full Post »

css for asp:GridView

.Grid { border: solid 1px #FFFFFF; }
.Grid td
{
border: solid 1px #FFFFFF;
margin: 1px 1px 1px 1px;
padding: 1px 1px 1px 1px;
text-align: center;
}
.GridHeader
{
font-weight: bold;
background-color: #8b8dbb;
}
.GridItem
{
background-color: #e6e6e6;
}

.GridAltItem
{
background-color: white;
}

<asp:GridView ID=”grdPermitRequest” runat=”server” AutoGenerateColumns=”False” DataSourceID=”srcPermitRequest” Width=”100%” CssClass=”Grid”>
<HeaderStyle CssClass=”GridHeader”></HeaderStyle>
<AlternatingRowStyle CssClass=”GridAtlItem”/>
</asp:GridView>

Read Full Post »

CSS for ASP:HyperLink

.WhiteLink
{
color:#FFFFFF;
text-decoration: none;
font-weight:bold;
}
.WhiteLink:hover
{
background:#E6E6E6;
color:#000000;
text-decoration:none;
}

<asp:HyperLink ID=”lnkRequesList” runat=”server” NavigateUrl=”ViewRequestPage.aspx” CssClass=”WhiteLink”>Request Link</asp:HyperLink>

Read Full Post »