如何在roedatabound事件中找到gridview id [英] how to find gridview id in roedatabound event

查看:113
本文介绍了如何在roedatabound事件中找到gridview id的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨。我想在RowDataBoundevent.how中找到gridview Id我能找到请告诉我任何人紧急

hi .i want to find the gridview Id in RowDataBoundevent.how can i find please tell me anyone urgent

推荐答案

你将有一个定义的RowDataBound处理程序给定网格。您应该始终知道网格ID,因为只有在触发DataBind事件时才会调用给定网格的事件。



此事件用于处理行级功能,例如:

You will have a defined RowDataBound handler for a given grid. You should know the Grid ID at all time as the event for a given grid will be called only when you trigger the DataBind event.

This event is for handling row level feature, example:
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) {
        if(e.Row.RowType == DataControlRowType.DataRow)
        {
            Decimal Price = (decimal)DataBinder.Eval(e.Row.DataItem, "Price");
            if(Price<20)
            {
                e.Row.ForeColor = System.Drawing.Color.Red;
                e.Row.BackColor = System.Drawing.Color.Black;
            }
        }
    }


这篇关于如何在roedatabound事件中找到gridview id的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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