如何在按钮点击时显示asp.net gridview的弹出窗口 [英] how to show pop up of asp.net gridview on button click

查看:334
本文介绍了如何在按钮点击时显示asp.net gridview的弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有选择链接列和其他列的asp.net gridview,我想在按钮点击时显示gridview弹出窗口,我想将所选列id传递给页面,我该如何实现任务。 br $>




请帮帮我。



提前谢谢

I have an asp.net gridview with select link column and some other columns, i want to show pop up of gridview on button click and i want to pass the selected columns id to page, how can i achieve the task.


pls help me.

thanks in advance

推荐答案

代码为itemtemplate

Code For itemtemplate
<asp:linkbutton id="LinkButton3" runat="server" commandname="passid" commandargument="<%# Bind("Id") %>" text='Select' xmlns:asp="#unknown"></asp:linkbutton>

< br $> b $ b






protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (e.CommandName == "passid")
        {
            Session["id"] = e.CommandArgument.ToString();
            //Label18.Text = Session["id"].ToString();
            Response.Redirect("yourpage.aspx?id=" + Session["id"].ToString() + "");
        
        }
    }









使用aref标签在该选择按钮上



OR

use aref tag On that select button

<a href='yourpage.aspx?id=<%# Eval("Id") %>'">
                    <asp:Label ID="Label1" runat="server" Text="Select" ></asp:Label>
                  </a>


您可以通过使用事件冒泡来实现,请通过以下链接获取帮助。

HTTP:// www.aspforums.net/Threads/414279/How-to-open-Popup-Window-on-click-of-Link-Button-inside-GridView-in-ASPNet/ [ ^ ]
You can achieve by using event bubbling, go through the below link for your help.
http://www.aspforums.net/Threads/414279/How-to-open-Popup-Window-on-click-of-Link-Button-inside-GridView-in-ASPNet/[^]


hi,

你可以使用下面的代码将选定的列ID传递给页面


you can pass selected columns id to the page by using the bellow code
<asp:templatefield headertext="Select" itemstyle-horizontalalign="Center" xmlns:asp="#unknown">
                   <itemtemplate>
                       <asp:imagebutton id="imgsearch" runat="server" commandargument="<%# Eval("Id") %>" />
                   </itemtemplate>
                   <itemstyle horizontalalign="Center" />
               </asp:templatefield>


aspx.cs页面中的


public static int id;

id = Convert.ToInt32(((ImageButton)sender).CommandArgument);


in aspx.cs page
public static int id;
id = Convert.ToInt32(((ImageButton)sender).CommandArgument);


这篇关于如何在按钮点击时显示asp.net gridview的弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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