GridView-模板字段中的行突出显示 [英] Row highlight in GridView - Template field

查看:92
本文介绍了GridView-模板字段中的行突出显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 我想在模板"字段中单击链接"按钮时突出显示gridview行.

如何对行数据进行绑定?

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


Guhananth.S

推荐答案

请参见 [ ^ ].


abhinav提供的解决方案是在网格绑定数据时突出显示行.

我可以建议您两种解决方案.

1.使用JScript
  • 分配LinkButtonOnclientclick并将其作为LinkButton本身传递给function,如果仅要突出显示模板字段并找到LinkButton的父项,则进一步找到LinkButton的父项如果要突出显示整行,请使用templatefield.使用Javascript
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
  • 在Modify Command时通过RowIndex并使用RowIndex的值并将CSV值放入,并在获得RowIndex之后可以使用
  • Pass RowIndex at a time of Modify Command with the value and put CSV value of RowIndex and after getting RowIndex you can use
gv.Rows[3].BackColor = "#333333";




这篇关于GridView-模板字段中的行突出显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆