Monday, September 21, 2009

Comparing Web Site Projects and Web Application Projects

http://msdn.microsoft.com/en-us/library/aa730880(VS.80).aspx

http://www.techbubbles.com/aspnet/aspnet-website-vs-web-application-project/

kalyan explained this in a simple way.

Monday, September 14, 2009

Wednesday, July 22, 2009

Internet Explorer Developer Toolbar

IEDevToolBarSetup.msi

http://www.microsoft.com/downloadS/details.aspx?familyid=E59C3964-672D-4511-BB3E-
2D5E1DB91038&displaylang=en

helps in Validate HTML, View HTML object class names

Explore and modify the document object model (DOM)

Wednesday, February 11, 2009

StringCollection vs ArrayList

ArrayList is Obsolete.

ArrayList of strings, better or StringCollection .

Cost of Casting occurs in both cases when accessing item from both collections.

ArrayList we need to implement toString(), StringCollection Wrapper implements this method internally.

Friday, February 6, 2009

Client-side Paging for DataGrids

http://msdn.microsoft.com/en-us/magazine/cc164022.aspx

Example to use js array to bind a GridView

Using Ajax Data Controls we can do this.

here is the sample

"<" AjaxData:Gridview ID="ImagesList" runat="server" Visible=True ">"

"<"/AjaxData:GridViewBoundColumn>
""<"/AjaxData:GridViewBoundColumn">"

"<"/AjaxData:Gridview">"


function pageLoad(sender, e)
{
var data = new Array();
data[0] = { Id: 1, Name: "Scott" };
data[1] = { Id: 2, Name: "Tiger" };
data[2] = { Id: 3, Name: "Zeke" };
data[3] = { Id: 3, Name: "Joe" };
adc.set_dataSource(data);
adc.dataBind();
}

Wednesday, February 4, 2009

AJAX GridView paging Cutting Edge

































C# Code copy and paste....


protected void bindGridView()
{
string connectionString = ConfigurationManager.ConnectionStrings["SqlConnectionString"].ToString();
SqlConnection sqlCon = new SqlConnection(connectionString);


try
{
SqlCommand sqlCmd = new SqlCommand("select * from products", sqlCon);
sqlCmd.CommandType = CommandType.Text;
SqlDataAdapter sqlAdp = new SqlDataAdapter(sqlCmd);
DataSet myDataSet = new DataSet();
sqlAdp.Fill(myDataSet);


// Delay the current Thread to display
// the UpdateProgress status
// Not required in real projects
System.Threading.Thread.Sleep(4000);


GridView1.DataSource = myDataSet;
GridView1.DataBind();
}
catch (Exception ex)
{
lblErrorMsg.Text = ex.Message;
}
}


protected void btnLoadData_Click(object sender, EventArgs e)
{
bindGridView();
}


protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
{
GridView1.PageIndex = e.NewPageIndex;
bindGridView();
}


Note: i was trying to execute this using PageIndex Changed . instead use PageIndexChanging.. paging works fine.

ajax for beginners

I dont know why some one has named it ajax. but in 2003 i have written an application using xmlhttp object . which was used to communicate with xml webservice to get a resultset. and display the results in excel.

i will show the example what i have done in my next post.

motivation is share mere yaar " share the knowledge" .

ajax is asynchronous call made using javascript either to the .net web application or webservice.

we need following minumum javascript methods to make a call.

/*---- Get xml http object ---*/

function GetXmlHttpObject() {
var xmlHttp = null;
try {
// Firefox, Opera 8.0+, Safari
xmlHttp = new XMLHttpRequest();
}
catch (e) {
// Internet Explorer
try {
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e) {
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}

/*---------------------*/



function stateChanged() {
if (xmlHttp.readyState == 4) {
....Write your code to assign response to the html dom element.
}
}


here is the java script funtino can be called on each key up on text box
following function gets the employee details from getEmployee.aspx page.

function showEmployee(str) {
xmlHttp = GetXmlHttpObject();
if (xmlHttp == null) {
alert("Your browser does not support AJAX!");
return;
}
var url = "getEmployee.aspx";
url = url + "?q=" + str;
url = url + "&sid=" + Math.random();
xmlHttp.onreadystatechange = stateChanged;
xmlHttp.open("GET", url, true);
xmlHttp.send(null);
}

any questions please drop a question.

thanks