I have a list of files in a GridView and I made a LinkButton for each row that contains the full path to the file. They are all pdf files on a network drive. I want the user to be able to click the button and view the pdf in a new window. When I click the button I get a 404 not found error even though I have verified that it is definitely passing the name of a valid file. Here is my code. Am I doing something obviously wrong?
Thanks for any insight.
Code:
protected void gvwSearchResults_RowCommand(Object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Select")
{
// Convert the row index stored in the CommandArgument
// property to an Integer.
int index = Convert.ToInt32(e.CommandArgument);
// Get the file path from the appropriate
// cell in the GridView control.
GridViewRow selectedRow = gvwSearchResults.Rows[index];
LinkButton tempButton = (LinkButton)selectedRow.Cells[4].Controls[0];
lblNoResults.Text = "test: " + tempButton.Text;
string scriptString = "<script language='javascript'>window.open('" + tempButton.Text + "');</script>";
ClientScript.RegisterClientScriptBlock(this.GetType(), "PopUpwindowOpen", scriptString);
}
}
Thanks for any insight.