.comment-link {margin-left:.6em;}

.code

.. Hello Earthling .. \o/ :)

.Net Frameworke 2.0 Special Code Coverage Edition
Saturday, September 18, 2004

If you are concerned about the portions that your managed applications depend on in .net and win32, than you can help provide microsoft with this information so they can do better on maintaining compatibility on future releases of the .net framework. Its a 2.0 beta1 special release which comsumes more memory and also is slower than the regular 2.0 beta1 because of the way it runs. Download it here. I'll download it right away.


Back ground color of selected row in Datagrid
Tuesday, September 07, 2004

Talking about ASP.net, we needed a functionality so that when someone comes and clicks on any row of the datagrid the row would highlight or change its color so to look different than other rows. I wrote the following code to solve this:

var prevrowobj= null;
var prevrowcolor="";
var prevfont="";
function JSchangecolor(obj)
{
if (prevrowobj!=null){
prevrowobj.style.backgroundColor=prevrowcolor ;
prevrowobj.style.fontWeight='normal' ;
prevrowobj.style.color = '#000000';
}
prevrowobj=obj;
prevrowcolor =obj.style.backgroundColor;
//prevfont = obj.style.font;

obj.style.backgroundColor ='#003399';
obj.style.fontWeight= 'bold';
//obj.style.cssText = 'CSS/css.css';
obj.style.color = '#EEFCC6';

}

this code worked fine but somebody included a linkbutton in there grid and this code worked for all columns except for the text in the columns that had linkbuttons. So I had to use some of the Table object Model (TOM) or DHTML or whatever its called and changed the code to following to make it work for all columns:

var prevrowobj= null;
var prevrowcolor="";
var prevfont="";
function JSchangecolor(obj)
{
if (prevrowobj!=null){
prevrowobj.style.backgroundColor=prevrowcolor ;
prevrowobj.style.fontWeight='normal' ;
prevrowobj.style.color = '#000000';
checkall( prevrowobj,0);

}
prevrowobj=obj;
prevrowcolor =obj.style.backgroundColor;
obj.style.backgroundColor ='#003399';
//obj.style.fontWeight= 'bold';
obj.style.color = '#EEFCC6';
checkall( obj,1 );
}
function SetColors(obj)
{
obj.style.color = '#EEFCC6';

}
function RestoreColors(obj)
{
obj.style.color = '#000000';
}
function checkall(obj,x)
{
for (var i=0; i< xobj="obj.cells[i].childNodes[0];" nodename="=" x ="=">

following server side code has to be written to add the onclick event to every row of the datagrid:
Public Shared Sub changecolor(ByVal grd As DataGrid)
Dim dt As DataGridItem
For Each dt In grd.Items
dt.Attributes.Add("onclick", "JSchangecolor(this)")

Next
End Sub







Blogs:

MSDN Blogs
Joel Pobar
Don Syme

Friends:
Adeel
Aqeel
#Fahad
Haroon
Omer
Muhammad Ali
Lahore Food Blog

Links:
Rotor
CodeGuru
Mozilla
OpenSourceNokia
Tech Blog

Languages:
IronPython
F#

Archives

June 2004   July 2004   August 2004   September 2004   October 2004   November 2004   December 2004   February 2005   April 2005   June 2005   July 2005   September 2005   October 2005   November 2005   June 2007   December 2007   January 2008   March 2008   April 2008   June 2008   October 2008   February 2009   May 2009   June 2009   July 2009   August 2009   March 2011   June 2011   July 2011   September 2011   October 2011   November 2011   December 2012   May 2013   October 2013   May 2014   March 2015   July 2015   August 2015   December 2015   March 2016   July 2016   October 2016   November 2016   July 2017  

This page is powered by Blogger. Isn't yours?