aadi patel

aadi patel

  • NA
  • 53
  • 33.5k

Gridview Buttonfile Click in new window not working

Oct 30 2012 4:29 AM
0 down vote favorite I have gridview. i want to open new page on following button click My
button click not working !

<asp:GridView ID="GridView1" runat="server" CellPadding="4" ForeColor="#333333" GridLines="None" OnRowCommand="GridView1_RowCommand" >
 <Columns> <asp:ButtonField Text="TASK" ButtonType="Button" CommandName="TASK" />   </Columns> </asp:GridView>

i want to open new page on following button click
My button click not working !


protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
 if (e.CommandName.Equals("TASK"))
 {
 int index = Convert.ToInt32(e.CommandArgument);
  GridViewRow gvrow = GridView1.Rows[index];
 string name= gvrow.Cells[1].Text;
  string surname= gvrow.Cells[2].Text;
 Response.Write("window.open( 'Mypage.aspx?name="+name+"&surname="+surname+"' , '-blank' );");
 }
 }

 how to open boundfield button click in new window ? please help.

Answers (2)