将按钮放入gridview列并为每个按钮生成每个事件 [英] placing buttons in to a gridview column and generating each event for each button

查看:66
本文介绍了将按钮放入gridview列并为每个按钮生成每个事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在gridview列中添加了一个按钮。如果我点击第一行,第一列按钮然后必须发生一个事件,如果在另一个按钮上,则必须发生另一个事件等。请帮助我

i added a button to a gridview column. if i click on first row, first column button then one event must occur and if on another button then another event must happen, etc.. please help me

推荐答案

I认为你是Asp.net的新手。对于您的信息,对于每个操作,例如gridview中的(按钮单击)和事件将被触发。您需要设置按钮的 CommandName 属性。 GridView中按钮的事件可以在gridview的 RowCommand 事件中轻松处理。在那里你需要检查命令名称并相应地进行编码。

它就像:

I think you are very new to Asp.net. For your Information, for every action, such as (button click) in gridview and event will be fired. You need to set CommandName property of the buttons. The events of the buttons inside GridView can handle easily in RowCommand event of the gridview. There you need to check the command name and do the coding accordingly.
It''s like:
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
    if (e.CommandName == "Edit")
    {
        //Do your job here
    }
    else if (e.CommandName == "SomeOtherCommand")
    {
        //Do your job here
    }
}







--Amit




--Amit


这篇关于将按钮放入gridview列并为每个按钮生成每个事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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