Thursday, October 16, 2008

Convert Asp.net to Asp.net Ajax enabled website in Asp.net 2.0

How can I convert the asp.net website to Ajax enabled website in asp.net 2.0

This quation was very difficult for me change the simple website to Ajax enable website. Simply if we want to make ajax enabled website then select the Ajaxenabledwebsite from the Dashboard when click on file new and website. but if I din't this then I faced problem to convert this asp.net website to Ajax enabled website. its very simple

step1: add the ajaxcontrolltoolkit.dll in your application bin folder by add refrence.

step2: add the some line of code in web.config inside the

Friday, September 19, 2008

Disable or readonly the checkbox using javascipt

For disable or readonly the checkbox using javascipt use the disable property of checkbox.

document.getElementById("ChkBoxName").disabled =false;

And for the Enable the checkbox using javascript

document.getElementById("ChkBoxName").disabled =true;

Check the column value if value is in string format with coma separated using Sql

If column value is in 1,2,34,23,44,444,12,23,... format than how can check the value using like operator in Sql. means if the coma separated value is in column in any table then how can check the value using like operator in Sql.

solution:
select * from s
where
sid like '44,%' or sid like '%,44,%'
or sid like '%,44' or sid='44'

where sid is column name
this will only return the 44

Return Multi Row value in a single column with comma seprated

Return Multi Row value in a single column with comma seprated using sql
I want Return output like 1,2,3,4,5 using sql.
There is one table in which has column
id name
1 Dilip
2 Dinesh
3 Varun
4 Dhanpat
5 Renuka

solution:
declare @a varchar(500)
set @a = ' '
select @a = @a + cast(id as varchar(20)) + ',' from tablename
if len(@a)>1
set @a= left(@a,len(@a)-1)
select case @a when '' then '0' else @a end as id


Use case , becaue may be there is no any value in this table so it will retun o

Sunday, July 27, 2008

Factory patteren based code in C#.net

IMPLEMETN THE INTERFACES AND USE IT FACTORY PATTERN BASE CODE

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;



public interface myinterface
{
int add(int x,int y);
//int mul(int w, int z);

}


public class class1 : myinterface
{
public int add(int a, int b)
{
int c = a + b;
return c;
}

}


public class class2 : myinterface
{
public int add(int j, int k)
{
int l = j * k;
return l;
}

}


class Factory
{
public myinterface GetObject(int type)
{
myinterface base1 = null;
switch (type)
{
case 1:
base1 = new class1();
break;
case 2:
base1 = new class2();
break;
}
return base1;
}
}


public partial class _Default : System.Web.UI.Page
{
Factory factory = new Factory();
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{
myinterface mytest = factory.GetObject(1);
int result = mytest.add(Convert.ToInt32(TextBox1.Text.ToString()), Convert.ToInt32(TextBox2.Text.ToString()));
txtresult.Text = Convert.ToString(result);



}

protected void Button2_Click(object sender, EventArgs e)
{

myinterface multiply = factory.GetObject(2);
int multiplevalue = multiply.add(Convert.ToInt32(TextBox1.Text.ToString()), Convert.ToInt32(TextBox2.Text.ToString()));
txtmultiply.Text = Convert.ToString(multiplevalue);


}


}