Click here to Skip to main content
15,896,439 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
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
Posted
Updated 9-Dec-13 19:12pm
v2
Comments
Karthik_Mahalingam 10-Dec-13 1:21am    
post your code..

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



C#
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() + "");
        
        }
    }


OR

use aref tag On that select button
ASP.NET
<a href='yourpage.aspx?id=<%# Eval("Id") %>'">
                    <asp:Label ID="Label1" runat="server" Text="Select" ></asp:Label>
                  </a>
 
Share this answer
 
v4
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/[^]
 
Share this answer
 
hi,
you can pass selected columns id to the page by using the bellow code
C#
<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>

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

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900