By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,652 Members | 1,337 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,652 IT Pros & Developers. It's quick & easy.

In DataGrid OnClick Event i want to show Some color

P: n/a
Hi All

In datagrid OnMouseOver iam showing some color
Onmouseout also working fine .
Here my problem is when ever click the pariculat row in DataGrid iam showing
red color that time i am not getting any problem .
when ever mouse was changed paricular row that time color is lossed
"When ever click the particular Row That time i want to show that color &
that time dont loss that color( when ever onMouseover changed)"
Here it's not happening
Here i am using this code "Onclick event " it is showing that color but it
is not stable that color :
e.Item.Attributes.Add("onclick","this.style.backgr oundColor='Red';
this.style.cursor='hand';");

e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor='Silver';
this.style.cursor='hand';");

e.Item.Attributes.Add("onmouseout","this.style.bac kgroundColor='yellow';
this.style.cursor='hand';");
Regards,
Karunakara Rao.



Nov 19 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
instead of setting the background color, use style defined in your style
sheet. This makes it so you can change the formatting without recompiling.
Also, this means you can...

<style>
..hoverStyle {background-color: silver; cursor:hand}
..regularStyle {background-color: yellow; cursor:hand}
..clickedStyle (background-color: red; cursor:hand}
</style>
....and in your code...

e.Item.Attributes.Add("onclick","this.className='c lickedStyle';");

e.Item.Attributes.Add("onmouseover",
"if(this.className!='clickedStyle')this.className= 'hoverStyle';");
e.Item.Attributes.Add("onmouseout","if(this.classN ame!='clickedStyle')this.c
lassName='regularStyle';")

.....and be sure to add, for default state...
e.Item.Attributes.Add("class","regularStyle")

"karunakar" <ka***********@stcroixsystems.com> wrote in message
news:OZ**************@TK2MSFTNGP12.phx.gbl...
Hi All

In datagrid OnMouseOver iam showing some color
Onmouseout also working fine .
Here my problem is when ever click the pariculat row in DataGrid iam showing red color that time i am not getting any problem .
when ever mouse was changed paricular row that time color is lossed
"When ever click the particular Row That time i want to show that color &
that time dont loss that color( when ever onMouseover changed)"
Here it's not happening
Here i am using this code "Onclick event " it is showing that color but it
is not stable that color :
e.Item.Attributes.Add("onclick","this.style.backgr oundColor='Red';
this.style.cursor='hand';");

e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor='Silver';
this.style.cursor='hand';");

e.Item.Attributes.Add("onmouseout","this.style.bac kgroundColor='yellow';
this.style.cursor='hand';");
Regards,
Karunakara Rao.


Nov 19 '05 #2

P: n/a
Thank u it's working fine

Here what ever select in datagrid row that can be deselect the row (when
ever click another row that is not happend in my DataGrid.)
I want deselect the partcular row

Regards
Karunakara Rao

"David Jessee" <dj*****@houston.rr.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
instead of setting the background color, use style defined in your style
sheet. This makes it so you can change the formatting without recompiling. Also, this means you can...

<style>
.hoverStyle {background-color: silver; cursor:hand}
.regularStyle {background-color: yellow; cursor:hand}
.clickedStyle (background-color: red; cursor:hand}
</style>
...and in your code...

e.Item.Attributes.Add("onclick","this.className='c lickedStyle';");

e.Item.Attributes.Add("onmouseover",
"if(this.className!='clickedStyle')this.className= 'hoverStyle';");
e.Item.Attributes.Add("onmouseout","if(this.classN ame!='clickedStyle')this.c lassName='regularStyle';")

....and be sure to add, for default state...
e.Item.Attributes.Add("class","regularStyle")

"karunakar" <ka***********@stcroixsystems.com> wrote in message
news:OZ**************@TK2MSFTNGP12.phx.gbl...
Hi All

In datagrid OnMouseOver iam showing some color
Onmouseout also working fine .
Here my problem is when ever click the pariculat row in DataGrid iam

showing
red color that time i am not getting any problem .
when ever mouse was changed paricular row that time color is lossed
"When ever click the particular Row That time i want to show that color & that time dont loss that color( when ever onMouseover changed)"
Here it's not happening
Here i am using this code "Onclick event " it is showing that color but it is not stable that color :
e.Item.Attributes.Add("onclick","this.style.backgr oundColor='Red';
this.style.cursor='hand';");

e.Item.Attributes.Add("onmouseover", "this.style.backgroundColor='Silver'; this.style.cursor='hand';");

e.Item.Attributes.Add("onmouseout","this.style.bac kgroundColor='yellow';
this.style.cursor='hand';");
Regards,
Karunakara Rao.



Nov 19 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.