asp.net中的CellClick事件 [英] CellClick Event in asp.net

查看:124
本文介绍了asp.net中的CellClick事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我是Asp.net的新手,但我想为asp的GridView实现CellClick事件,

喜欢在windows应用程序dataGridView1_CellClick()。

Hi All,

I am new to Asp.net but i want to implement CellClick event for asp''s GridView ,
like in windows application "dataGridView1_CellClick()".

推荐答案

这是我想要的网格视图...



This is grid view which was i want...

<asp:gridview id="gridView" runat="server" autogenerateselectbutton="True" xmlns:asp="#unknown">
                onselectedindexchanged="gridView_SelectedIndexChanged">
            </asp:gridview>





然后将其与数据库绑定





然后





then bind it with database


then

protected void gridView_SelectedIndexChanged(object sender, EventArgs e)
   {
       lblID.Text = gridView.SelectedRow.Cells[1].Text.ToString();
       lblName.Text = gridView.SelectedRow.Cells[2].Text.ToString();
   }





如需参考,请参阅以下链接...



http://www.dotnetfunda.com/articles/article442-how-to-get-the-values-of-selected-row-from-a- gridview-using-aspnet.aspx [ ^ ]


在GridViewSelected Index上更改事件使用此

其中Cells [1]或Cell [2]定义了您要使用的数据单元格。



Use this on GridViewSelected Index changed event
where Cells[1] orCells[2] defined the data cell you want to use.

protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {
        GridViewRow row = GridView1.SelectedRow;
        string your_data = row.Cells[1].Text;
    }


你好



你没有在网格中找到单元格点击事件查看。

但是您可以使用链接控件或html链接来触发特定事件。

Gridview提供RowCommand来获取任何子控件事件。

或在Asp.net中查找事件冒泡概念



谢谢

Harshad
Hello

U do not found the cell click event in grid view.
But u can use the link control or html link for fired the particular event.
Gridview provides the RowCommand to fetch any event of child control.
Or Find the event bubbling concept in Asp.net

Thanks
Harshad


这篇关于asp.net中的CellClick事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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