Click here to Skip to main content
15,903,201 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi I want to highlight the gridview row on click of link button in Template field.

how to do on Row Data bound?
<asp:TemplateField HeaderText="Action" ItemStyle-CssClass="alignCenter">
                            <itemtemplate>
                                <asp:LinkButton ID="lbComments" runat="server" Text='Edit' CommandArgument='<%# Eval("ProjectID")%>'
                                    CommandName="MODIFY" />
                            </itemtemplate>
</itemtemplate>

Guhananth.S
Posted
Updated 13-Dec-10 2:37am
v3
Comments
Abdul Quader Mamun 13-Dec-10 8:28am    
Use pre tag.

See this[^]. It may help you.
 
Share this answer
 
Comments
[no name] 13-Dec-10 9:30am    
on 1st click back color is seen and it goes off after.It is not continously highlighted.
The solution abhinav provided was to highlight row at the time grid binds data.

I can suggest you two way to achieve your solution.

1. Using JScript
  • Assign Onclientclick of LinkButton and pass this as a LinkButton itself to function, Further find the parent of LinkButton, if you want to highlight only template field and find the parent of templatefield if you want to highlight full row. using Javascript


2. Using CodeBehind
  • Pass RowIndex at a time of Modify Command with the value and put CSV value of RowIndex and after getting RowIndex you can use
    C#
    gv.Rows[3].BackColor = "#333333";



Try this hints you may get your solution around.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900