I've been trying for this but i didn succeeded.The problem is
I've a datagird which is having 2 cols displaying name and emial id .wht i want is when i select a paricular row from the gridview i want to capture the emial id value of tht paricular row.
I've added this code in the even onrowdatatbound.
Expand|Select|Wrap|Line Numbers
- protected void GridViewParticipants_OnRowDataBound(object sender, GridViewRowEventArgs e)
- /
- .
- .
- if (e.Row.RowType == DataControlRowType.DataRow)
- {
- e.Row.ID = e.Row.Cells[0].Text.ToString();
- e.Row.Attributes.Add("onclick", "javascript:Ongridrowselected('"+e.Row+ "','" + e.Row.Cells[0].Text + "')");
- e.Row.Attributes.Add("onmousehover", "javascript:Ongridrowmousehover('" + e.Row + "')");
- }
- The below are th two javascript functions.
- var lastselectedrow;
- var originalcolor;
- function Ongridrowselected(row,emailid)
- {
- var hidden=document.getElementById('hdnemailid')
- hidden.value=emailid;
- if(lastselectedrow !=row)
- {
- if(lastselectedrow != null)
- {
- lastselectedrow.style.backgroundColor=originalcolo r;
- lastselectedrow.stylr.color='Black';lastselectedro w.style.fontWeight='normal';
- }
- originalcolor=row.style.backgroundColor;
- row.style.backgroundColor='BLACK';
- row.style.color='White';
- row.style.fontWeight='normal';
- lastselectedrow=row;
- }
- }
- function Ongridrowmousehover(row)
- {
- row.style.cursor='hand';
- }
Plz tell me ehr is thr mistake.
Thank you..
**sorry for the bad english.
Regards,
BTR.
[/SIZE]