my UI
"My moto click any link open pdf file in new window but i want not use query string for security purpose"
my aspx .code
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false"
GridLines="None" Width="900px" CssClass="gridview" DataKeyNames="idno"
HeaderStyle-CssClass="header" RowStyle-CssClass="rows"
onrowdatabound="GridView1_RowDataBound">
<Columns>
<asp:TemplateField HeaderStyle-Width="10px">
<ItemTemplate>
<%#Container.DataItemIndex+1 %>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="?????">
<ItemTemplate>
<asp:HyperLink ID="bnv" runat="server" ToolTip='<%# string.Format("{0}=>[{1}]",Eval("link_level3"),Eval("url")) %>' CssClass="raj " Width="100%" Target="_New" Text='<%# Eval("link_level3") %>'></asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
cs code on row databound
{
string filepath = "WriteReadData/documents/";
if (e.Row.RowType == DataControlRowType.DataRow)
{
HyperLink hl = (HyperLink)e.Row.FindControl("bnv");
if (hl != null)
{
DataRowView drv = (DataRowView)e.Row.DataItem;
Session["id"] = drv["idno"].ToString();
//string lsDataKeyValue = GridView1.DataKeys[e.Row.RowIndex].Values[0].ToString();
SqlConnection con = new SqlConnection(str);
string query = "select filename from level3 where link_level3='" + hl.Text + "' ";
SqlCommand cmd = new SqlCommand(query,con);
con.Open();
string file_name = (string)cmd.ExecuteScalar();
con.Close();
if (file_name != null)
{
hl.NavigateUrl = filepath + file_name;
}
}
}
}
Error generate on page load
how to solves this please guid me
Thanks