Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8120717
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T05:14:18+00:00 2026-06-06T05:14:18+00:00

im having a gridview in only page and on clicking a button column field

  • 0

im having a gridview in only page and on clicking a button column field Gridview1_RowCommand gets executed.What im stuck at is on how to pass a single refno(which is in the grid) to the popup page.i want to use this refno to generate a query
help on this will really be appreciated
the below code i wat i used and im stuck here..

protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{

    Page.RegisterStartupScript("test", "<script language='javascript'>Openpopup();</script>");
}


 <script language='javascript'>
   var popupobj;
  function Openpopup() 
{
      popupobj = window.open("popup.aspx", "_blank", "width=1000,height=500,statusbar=no,toolbar=no,scrollbars=no,resizable=no,navbar=no,screenX=800,screenY=800top=100,left=100");
    popupobj.focus();
}
 </script>  
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T05:14:20+00:00Added an answer on June 6, 2026 at 5:14 am

    Since you are using RowCommand event, to be able to send this value to the Popup you need to set the RowIndex as a CommandArgument of the Button you are clicking to open the popup.
    Set the Value(refno) to passed to Popup in DataKey.

    protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        var Button1= e.Row.FindControl("Button1") as Button;
        Button1.CommandName = "ButtonClick";
        // cast RowIndex in line code to string if e.CommandArgument accepts string
        Button1.CommandArgument = e.Row.RowIndex;
    }
    

    Now in the RowCommand

    protected void GridView1_RowCommand(object sender, GridViewRowCommandArgs e)
    {
        if(e.CommandName == "ButtonClick")
        {
            var refno = GridView1.DataKeys[Convert.ToInt32(e.CommandArgument)]["refno"];
            Page.RegisterStartupScript("test", "<script language='javascript'>Openpopup(' + refno + ');</script>"); 
        }
    }
    

    This way now you have refno in the Javascript function argument. Pass this argument as a querystring in the Javascript popup function.

    This way you can access refno in the Popup page.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a asp gridview with button field column on that button click I
I am having a gridview with some columns and a template field column that
I am having a Gridview. I had placed a delete button in the last
I am having editable Gridview with column named Country which has so long listing.
I having the page in that i have the gridview and page index changing
Iam having a gridview with textboxes in itemtemplate. If textbox validation fails whiling clicking
Hi all i am having 2 imagebuttons a gridview and a button. Now if
i am having a gridview. when i select it, the selector(orange color) will shows
I'm having a heck of a time trying to get a gridview to refresh
all. I'm having a problem getting the GridView.AutoGenerateEditButton property to do anything for me.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.