button click not working !
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.
Neha SharmaPosted Oct 30, 2012, 6:56 AM
"OR"
As discussed you can do as below in to your gridview:
In Design:
DataNavigateUrlFormatString="adminUpdateExclusive2.aspx?Prodid={0}" />
In next page on page load:
string pid;
pid = Request.QueryString["Prodid"].ToString();
Note: Never forget to mention datakeyname(i used product id/prodid).
If it helps you mark it as answer else let me know what is remain.
Neha SharmaPosted Oct 30, 2012, 5:56 AM
For this you can sue following link:
http://stackoverflow.com/questions/5963806/command-behind-a-gridview-buttonfield