GridView的SelectedIndexChanged事件是不是firing.I正在使用asp.net 4.0。通过的方式RowDataBound事件是完全烧成 [英] gridview SelectedIndexChanged Event is not firing.I am using asp.net 4.0 .By the way rowdatabound event is firing perfectly

查看:93
本文介绍了GridView的SelectedIndexChanged事件是不是firing.I正在使用asp.net 4.0。通过的方式RowDataBound事件是完全烧成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

 <asp:GridView ID="gridPlace" runat="server" AutoGenerateColumns="False" Width="800px"
        BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px"
        CellPadding="5" OnRowDataBound="gridPlace_RowDataBound" OnSelectedIndexChanged="gridPlace_SelectedIndexChanged">
        <Columns>
            <asp:BoundField HeaderText="DetailID" DataField="PID" />
            <asp:BoundField HeaderText="Name" DataField="Name" ControlStyle-Width="200px" />
            <asp:BoundField HeaderText="Description" DataField="Description" />
            <asp:TemplateField>
                <ItemTemplate>
                    <asp:ImageButton ID="btnEdit" runat="server" ImageUrl="~/Images/Edit.png" ToolTip="Click To Edit this Record" />
                </ItemTemplate>
                <ItemStyle Width="40px" HorizontalAlign="Center" />
            </asp:TemplateField>
        </Columns>
        <EmptyDataTemplate>
            <h2 class="CustomErrorMsg">
            No Record Found</h3>
        </EmptyDataTemplate>
    </asp:GridView>

下面是我对gridview.RowDatabound事件的HTML标记发射perfectly.Kindly帮助

Here is my html markup for the gridview.RowDatabound event is firing perfectly.Kindly Help

推荐答案

您不能只是点击一个行的任意触发事件,则需要JavaScript来做到这一点。认为这些将有助于

You cannot just click anywhere on a row to fire the event, you will need JavaScript to do that. Think these would help


  1. &LT; ASP:GridView控件=服务器ID =GridView1AutoGenerateSelectButton =真/&GT; - 如何启用默认在GridView Web服务器控件中选择

添加

&LT; ASP:的TemplateField&GT;
    &LT;&ItemTemplate中GT;
      &LT; ASP:LinkBut​​ton的的CommandName =选择/&GT;
   &LT; / ItemTemplate中&GT;
   &LT; / ASP:的TemplateField&GT;

使用JavaScript,如果你不想选择按钮出现 - HTTP ://forums.asp.net/t/992062.aspx/1

Use JavaScript if you don't want the select button to appear - http://forums.asp.net/t/992062.aspx/1

&LT; ASP:CommandField中ShowSelectButton =真按钮类型=图像/&GT; - http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.commandfield.aspx

这篇关于GridView的SelectedIndexChanged事件是不是firing.I正在使用asp.net 4.0。通过的方式RowDataBound事件是完全烧成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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