Some bits of code:
Sometimes little bits can come in very handy. Here are a couple.
C# version of IsNumeric( ) :
public static bool IsNumeric(object value) { try { int i = Convert.ToInt32(value.ToString()); return true; } catch (FormatException) { return false; } }
There are times when you do not want a postback to occur for a control on your ASP.NET page. This example shows how javascript can be used to process the event and suppress the postback. Returning false from javascript for a method on a control will prevent ASP.NET from processing the postpack. This example will redirect the client to a new page without first making a postback to the server. The code is placed in the Page_Load method of the ASP.NET Page:
ImageButton1.Attributes.Add("onclick", _ "top.location.href=''" & _ ";return false;")
6:54:28 PM
|