473,320 Members | 1,884 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

gridView row selected

Hi,

I use GridView control in asp.net.
I would like to write an event on the client site. When somebody click on
row, I would like to clear all selected rows in GridView and changed cliked
row color in permanent way.
How to do it in JavaScript ?

Thank you for help

Oct 21 '08 #1
1 5589
On Oct 21, 3:47*pm, "imbirek8" <imbir...@op.plwrote:
Hi,

I use GridView control in asp.net.
I would like to write an event on the client site. When somebody click on
row, I would like to clear all selected rows in GridView and changed cliked
row color in permanent way.
How to do it in JavaScript ?

Thank you for help
Yes it is possible. ASP.NET grid view is nothing but HTML table at
client side.
You have to write some script to bind all events to the grid (i.e.
HTML table) once body load complete. Like on body load

function onbodyload()
{
var oGrd = docuement.getElementById("grid view name");//grid name
some time changes if you are using master page or user control.
//You could do same thing at grid click level but again you have to
play with srcElement of IE or //target for Moz as well as nodeName
for(var i = 0; i < oGrd.rows.length; i++)
{
oGrd.rows[i].onclick = onrowclick;//Bind the click event for each
row
if(i % 2 == 0)//setting row color alternate
oGrd.rows[i].style.backgroundColor = "green";
else
oGrd.rows[i].style.backgroundColor = "yellow";

}
}

function onrowclick(oRow)
{
alert(oRow.rowIndex);
}
please check this and if it is working fine then easily you can delete
row. Other wise I will help you.
Oct 21 '08 #2

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

Similar topics

2
by: NH | last post by:
How can I set the selected item in a dropdownlist which is declared in the edititemtemlpate of a gridview? Which gridview event should I use, I cant seem to figure it out...
5
by: mosscliffe | last post by:
Following Mr Tabors Video on Databinding I implemented the following code In GridViewSelectedIndexChange I coded DetailsView1.pageindex = gridview1.selectedindex This works fine for the...
0
by: Child X | last post by:
Hi all, I have a web form with two GridViews on it. GridView 'A' populates GridView 'B' based on it 'SelectedRowValue'. What i am after, is ...if someone delete a row from grid 'A' and it is...
0
by: CK | last post by:
Hi All, I have a gridview that contains a column that has a repeater inside it. My intent is to put every comment for an album into the repeater in the comments column. I am using a SQLDataSource...
2
by: Kirk | last post by:
I have a GridView that displays several columns, one of which is a checkbox field. This is populated at runtime from a SqlDataSource and is not enabled (the user can't change it's value). I have...
1
by: shapper | last post by:
Hello, I have a two elements on my page: a GridView and form that has various controls (textboxes, dropdownlists, etc) When I click a GridView row I need to fill the form controls. I will use...
1
by: Dinu | last post by:
hi i am having a gridview in aspx page and a usercontrol in master page of that page now what i want is selected row text to be displayed in usercontrol i wrote code as follows: ...
1
by: DAnDA | last post by:
Hey i binding gridview/formview using one sqlDataSource,, that mean formview show all details from gridview selected row,,, now i cant use paging property for formview ,,, can anyone show me how to...
1
by: Sobin Thomas | last post by:
Hi All....... I am a beginner in asp.net. How can I call a javascript function on the selected index change of Gridview ,in asp.net? Can you help me with sample code? Thanks in advance....
0
by: perumalsamy R | last post by:
I am using gridview in my project.When i am clicking the checkbox ,I want to add the price value on gridview selected index changed event.can you help for my problem please help me?
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.