单击“编辑”时以编程方式更改 EditRowStyle
我有一个 ASP.NET(2.0 使用 C#)网络应用程序,其中有一个 gridview。 我其中有一个编辑列,但我没有使用常规编辑功能。 单击“编辑”时会发生其他事情。
我想知道如何更改 GridView_RowEditing 函数中单击“编辑”的行的样式?
我尝试过:
protected void Grid_RowEditing(object sender, GridViewEditEventArgs e)
{
Grid.Rows[e.NewEditIndex].BorderStyle = BorderStyle.Groove;
//Do some Other things
}
当我单击它时,其他功能可以工作,但样式不会改变。 我想做的就是更改 editRow 的样式,以便我可以知道它是哪一个。
谢谢。
I have an ASP.NET(2.0 using C#) web app, in which I have a gridview. I have an Edit column in it, but I'm not using the regular Edit functionality. When Edit is clicked something else happens.
I wanted to know how to change the style of the row in which Edit was clicked in the GridView_RowEditing
function?
I have tried this:
protected void Grid_RowEditing(object sender, GridViewEditEventArgs e)
{
Grid.Rows[e.NewEditIndex].BorderStyle = BorderStyle.Groove;
//Do some Other things
}
When I click it, the other functionality works, but the style doesn't change. All I want to do is to change the style of the editRow so that I can tell which one it is.
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
据我了解,您可以在 GridView 中为 SelectedItem 设置特定的样式。 然后,当单击编辑按钮时,您可以执行此操作 -
执行此操作后,将选择编辑模式下的行,并将应用“SelectedItem”样式。
As far as I understand, you can setup a particular style for SelectedItem in the GridView. Then when the edit button is clicked, you can do this -
After doing this, the row in edit mode will get selected and the "SelectedItem" style will be applied to it.