martes, 12 de abril de 2011

imagenes para botones

Una pagina que contiene muchos botones  e iconos para nuestras aplicaciones.

(ugly english mode: ON)
A web page that contains many buttons and icons for us aplications.


http://findicons.com/

lunes, 11 de abril de 2011

Error alert al intentar mostrar exception.

Las soluciones al error son las siguientes:


//if you have AJAX support (even if you aren't using it), use this:
ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "uniqueKey" + DateTime.Now, "alert('" + ex.Message.Replace("'", "") + "');", true);
//if you're using asp.net 2.0 and have no access to MS AJAX, use this: ClientScript.RegisterClientScriptBlock(typeof(Page), "uniqueOtherKey" + DateTime.Now, "alert('" + ex.Message.Replace("'", "") + "');", true);


 
Lo vi en:
http://forums.asp.net/t/1292611.aspx 

A mi me funcionó la primera, como ven la solución es el Replace.

Replace("'", "") 
 
Ahora he hecho una solucion mas sofisticada o menos fea, creo una clase en 
la capa de negocio asi: 
 
namespace Proyecto.Business.Util
{
    public static class Conversion
    {
public static string QuitaCaracterRaro(string str)
        {
            string[] arregloCaracteresRaros = { "'", "\n", "\t", "\r" };

            foreach (string element in arregloCaracteresRaros)
            {
                str = str.Replace(element, "");
            }

            return str;
        }
}
}
y la utilizo del siguiente modo:
 
 
ScriptManager.RegisterStartupScript(this.Page, GetType(), "Aviso" + DateTime.Now, 
"alert('Houston, tenemos problemas. Detalle = " + Conversion.QuitaCaracterRaro(ex.Message) 
+ "');", true);