473,569 Members | 2,676 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

In DataGrid OnClick Event i want to show Some color

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.Attribut es.Add("onclick ","this.style.b ackgroundColor= 'Red';
this.style.curs or='hand';");

e.Item.Attribut es.Add("onmouse over", "this.style.bac kgroundColor='S ilver';
this.style.curs or='hand';");

e.Item.Attribut es.Add("onmouse out","this.styl e.backgroundCol or='yellow';
this.style.curs or='hand';");
Regards,
Karunakara Rao.



Nov 19 '05 #1
2 2257
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.Attribut es.Add("onclick ","this.classNa me='clickedStyl e';");

e.Item.Attribut es.Add("onmouse over",
"if(this.classN ame!='clickedSt yle')this.class Name='hoverStyl e';");
e.Item.Attribut es.Add("onmouse out","if(this.c lassName!='clic kedStyle')this. c
lassName='regul arStyle';")

.....and be sure to add, for default state...
e.Item.Attribut es.Add("class", "regularSty le")

"karunakar" <ka***********@ stcroixsystems. com> wrote in message
news:OZ******** ******@TK2MSFTN GP12.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.Attribut es.Add("onclick ","this.style.b ackgroundColor= 'Red';
this.style.curs or='hand';");

e.Item.Attribut es.Add("onmouse over", "this.style.bac kgroundColor='S ilver';
this.style.curs or='hand';");

e.Item.Attribut es.Add("onmouse out","this.styl e.backgroundCol or='yellow';
this.style.curs or='hand';");
Regards,
Karunakara Rao.


Nov 19 '05 #2
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*****@housto n.rr.com> wrote in message
news:%2******** ********@TK2MSF TNGP14.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.Attribut es.Add("onclick ","this.classNa me='clickedStyl e';");

e.Item.Attribut es.Add("onmouse over",
"if(this.classN ame!='clickedSt yle')this.class Name='hoverStyl e';");
e.Item.Attribut es.Add("onmouse out","if(this.c lassName!='clic kedStyle')this. c lassName='regul arStyle';")

....and be sure to add, for default state...
e.Item.Attribut es.Add("class", "regularSty le")

"karunakar" <ka***********@ stcroixsystems. com> wrote in message
news:OZ******** ******@TK2MSFTN GP12.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.Attribut es.Add("onclick ","this.style.b ackgroundColor= 'Red';
this.style.curs or='hand';");

e.Item.Attribut es.Add("onmouse over", "this.style.bac kgroundColor='S ilver'; this.style.curs or='hand';");

e.Item.Attribut es.Add("onmouse out","this.styl e.backgroundCol or='yellow';
this.style.curs or='hand';");
Regards,
Karunakara Rao.



Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1392
by: karunakar | last post by:
Hi All Here i want to show in datagrid Broder color as like image showed i attaching images pls check and help me out "Onlclick" i want to show red border color each row in DATAGRID in ASP.NET In my Code: Back ground color i was done like that : e.Item.Attributes.Add("onclick","this.style.backgroundColor='Red';...
3
4898
by: vinayak | last post by:
Hi I am displaying data in Datagrid in ASP.NET with Edit/Update functionality for each row. On the same page I have 2 Button controls which submits the request to server. These button controls are Web Control & not HTML control. One of these buttons whose title is Delete is added on the aspx page in design view & also I double clicked on...
2
11655
by: Homa | last post by:
Hi, I have a Datagrid that uses as a shopping cart and have a checkbox template column in it. I can't add both OnCheckedChanged Event and onclick client script for it. I want to do two things: 1. I want the checkbox fires CheckedChanged event. I did this as
3
4863
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that the best method? Do you have a sample of how to do this?
2
5580
by: Dave | last post by:
Hi, I have a datagrid with a Templated column below. I want to execute some javascript before the postback to show a hidden "div" tag with static message of "Please Wait..." since the query takes a few seconds. The js function simply sets the css style to display. <asp:TemplateColumn> <ItemTemplate> <asp:LinkButton Runat="server"...
2
11604
by: Niclas Lindblom | last post by:
Hi, I have a datagrid with linkbuttons. I would like to catch the click event when a link button has been clicked and use the string from the text value of the link button in a clientside Java script. Is this possible or should I look for other ways of achieving this ? Regards Niclas
6
4631
by: JenHu | last post by:
Hi experts, I want to add a delete button in my datagrid, and before it deletes from database, I want to have a confirm dialog box for this deletion. I am entry level to the vb.net, and don't know java or c#. The problem is, when I tested the program, there is no pop-up confirmation box for the deletion, can you show me what' wrong with...
5
1460
by: ruca | last post by:
Hi, Can anyone give me examples of how can I hightlight cells of my datagrid? I know that I must use ItemBound event and probably JavaScript. The thing is that I have a anual calendar, constructed in a DataGrid. Then what I want is select a range of two dates in that same calendar to do any action.
7
322
by: Angelina | last post by:
Hiya, I have just created a datagrid binded to a dataview (as i wanted to limit the user from adding and editing rows in the datagrid). What i want to be able to do now is for the user to click anywhere on the grid but have the whole row highlighted instead of just the single cell. I would then like for the user to click a 'Remove' button...
0
7922
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8119
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7668
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7964
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5218
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3637
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2111
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1209
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.