网格视图的单击事件 [英] On click event of grid view

查看:78
本文介绍了网格视图的单击事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hellow
在我的一个应用程序中,我正在使用2 gridview显示数据.我想在gridview1的任何行上单击时在gridview2中显示数据.我不想使用gridviw1_rowCommand事件.
我该如何开发这样的应用程序.
请给我提示.

Hellow
In one of mine application i am using 2 gridview to display data. i want to display data in gridview2 on click of gridview1 any where in row. i do not want to use gridviw1_rowCommand event.
how can i develop such application.
Kindly give me hint.

推荐答案

使用此

在Gridview中选择一行点击行 [
Use this

Select a Row in a Gridview with a Click on Row[^]


嗨@ Aftab5124

如果您不想使用grid view row命令,则可以对每个控件使用commandname属性.然后在该命令名下执行您要执行的操作.
对于前
Hi @Aftab5124

If you don''t want to use the grid view row command then you can use commandname property for each control.and under that command name perform what you want to do.
for ex
<asp:GridView ID="GridView1" runat="server" BackColor="White"

           BorderColor="White" BorderStyle="Ridge" BorderWidth="2px" CellPadding="3"

           CellSpacing="1" GridLines="None">
           <RowStyle BackColor="#DEDFDE" ForeColor="Black" />
           <Columns>
              <asp:TemplateField>
              <ItemTemplate>
              <asp:Button runat="server" Text="clickme" CommandName="showdata()" />
              </ItemTemplate>
              </asp:TemplateField>
               <asp:TemplateField>
              <ItemTemplate>
              <asp:LinkButton ID="Button2" runat="server" Text="clickme" CommandName="showdata()"></asp:LinkButton>
              </ItemTemplate>
              </asp:TemplateField>
           </Columns>
           <FooterStyle BackColor="#C6C3C6" ForeColor="Black" />
           <PagerStyle BackColor="#C6C3C6" ForeColor="Black" HorizontalAlign="Right" />
           <SelectedRowStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" />
           <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#E7E7FF" />
       </asp:GridView>



在这里,我将button1和button2的showdata命令名称称为

希望对您有帮助

谢谢



Here i have called the showdata command name for the button1 as well as the button2

Hope it will help you

Thanks


这篇关于网格视图的单击事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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