Monday, June 29, 2009

How to Add HTML Tags without rendering

Calling JavaScript in ASP.NET

<html xmlns="" >
<head id="Head1" runat="server">
<title>Untitled Page</title>
<script type="text/javascript">
ShowValue = function()
<form id="form1" runat="server">
<asp:TextBox ID="TextBox1" runat="server" Text="2"></asp:TextBox>
<textarea rows="10" cols="30"

--------------------------- In Code Behind----------------------------------
protected override void OnInit(EventArgs e)
Page.ClientScript.RegisterStartupScript(Type.GetType("System.String"), "addScript", "ShowValue()", true);

you can also call the java script in OnLoad, OnLoadCompleted and etc.

How to Add page cycle events to ASP.NET

Add OnLoadComplete, OnPreRenderComplete, OnInit,OnInitComplete ..

normally these events are hidden from initially.
so in your Visual Studio Code Editor type

protected override and press space. IDE will populate event list for you.

Wednesday, June 24, 2009

Access Text Box in ASP using Java Script

Access Java Script using ASP.NET 

Assume that you have a java script file callled sample.js
in the file

function display() {
     var TextBox = document.getElementById(
    TextBox.value = "Hello";

In the Aspx Page

protected void Page_Load(object sender, EventArgs e)
            ClientScriptManager script = Page.ClientScript;
            if (!script.IsClientScriptIncludeRegistered("ScriptInFile"))
                script.RegisterClientScriptInclude("ScriptInFile", "

Assume you want to call the function on the onload event , then
in the body tag used Onload=display()

Sometime this may not be worked. because the problem of the text box id. ASP generete ID for text box. then what you have to do is run the aspx page ones and get the text box id using view sourse. then replace TxtID that.

Wednesday, June 17, 2009

Mouse Cursor Hide , Show Wait Cursor in Windows Mobile

Cursor.Current = Cursors.WaitCursor;


Cursor.Current = Cursors.Default;

Tuesday, June 16, 2009

Mobile Splash Screen

Set Mobile Form to Center Sreen

int x = (Screen.PrimaryScreen.Bounds.Width - frmSplash.Width) / 2;
int y = (Screen.PrimaryScreen.Bounds.Height - frmSplash.Height) / 2;

frmSplash.Location = new System.Drawing.Point(x, y);

how to Get Date in SQL Server, SQL Compact Query

Select Getdate() as ColumnName

Friday, June 12, 2009

Check Data Row is Null When Retreiving Data


Tuesday, June 2, 2009

Logon failed. Details: crdb_adoplus : Object reference not set to an instance of an object

Logon failed. Details: crdb_adoplus : Object reference not set to an instance of an object.
Error in File C:\DOCUME~1\JASONML\ASPNET\LOCALS~1\Temp\ReleasedDrawings {AA4B9DD0-25C5-40B9-9847-74F743ADEAED}.rpt: Unable to connect: incorrect log on parameters.

This error occurs because of error error in used dataset. Recreate the dataset will solve the problem.