Redirect to a form on button click in Grid View

时间:2016-02-03 04:20:13

标签: c# forms gridview popup buttonfield

I have build a GridView on a webpage, having two ButtonFields columns: Accept and Reject. Now when I click on Reject button, I want to show a popup form with some input fields and store that data into the Database.

I'm just stuck at showing the popup on clicking the reject button field. Is this possible?v

1 个答案:

答案 0 :(得分:0)

将代码放在.aspx文件中

<asp:TemplateField HeaderText="Edit" itemstyle-width="150px">
                                <ItemTemplate>
                                    <asp:LinkButton ID="btnEdit" runat="server" CommandName="Edit" Text="Edit" CausesValidation="false"/>
                                </ItemTemplate>    
                            </asp:TemplateField>  

将代码放入.cs文件

 if (e.CommandName.Equals("Edit"))
    {
        string QueryString="val";
        Page.ClientScript.RegisterStartupScript(GetType(), "", "window.open('Page.aspx?QS=" + QueryString + "','','width=500,height=500');"", true);
    }