Hi,
Here I have created sample using your code,It is working fine.
HTML
<div>
<asp:DetailsView ID="detailsview1" runat="server" GridLines="Vertical" AutoGenerateRows="False"
HeaderStyle-BackColor="#FFFFFF" HeaderStyle-ForeColor="White" CellPadding="3"
Height="50px" Width="446px" DataKeyNames="StoreNumber" BackColor="White" BorderColor="#cccccc"
BorderStyle="None" BorderWidth="1px" ForeColor="Black" CommandRowStyle-Font-Overline="true">
<Fields>
<asp:TemplateField HeaderText="Store Number:" HeaderStyle-Font-Names="Tahoma">
<ItemTemplate>
<asp:Label ID="lblStoreNum" ForeColor="#ff3300" runat="server" Text='<%# Bind("StoreNumber")%>'></asp:Label>
</ItemTemplate>
<HeaderStyle Font-Names="Tahoma" />
</asp:TemplateField>
<asp:TemplateField HeaderText="View Image">
<ItemTemplate>
<asp:LinkButton ID="LinkButton1" runat="server" ToolTip="View Image" CommandName="storage"
CommandArgument='<%# Eval("StoreNumber")%>' OnCommand="OpenViewPdf_Command">
<asp:Image ID="Image4" runat="server" ImageUrl="~/Images/viewImg_.png" ImageAlign="Middle"
Width="20" Height="15" Style="border-width: 0px; margin-left: 25px" /></asp:LinkButton>
</ItemTemplate>
<HeaderStyle Font-Bold="False" Font-Names="tahoma" Font-Size="9pt" Width="75px" />
<ItemStyle Font-Bold="False" Font-Names="tahoma" Font-Size="9pt" Width="75px" />
</asp:TemplateField>
<asp:TemplateField HeaderText="First Name:" HeaderStyle-Font-Names="Tahoma">
<ItemTemplate>
<asp:Label ID="lblFName" ForeColor="#ff3300" runat="server" Text='<%# Bind("FirstName")%>'></asp:Label>
</ItemTemplate>
<HeaderStyle Font-Names="Tahoma" />
</asp:TemplateField>
<asp:TemplateField HeaderText="Last Name:" HeaderStyle-Font-Names="Tahoma">
<ItemTemplate>
<asp:Label ID="lblLName" ForeColor="#ff3300" runat="server" Text='<%# Bind("LastName")%>'></asp:Label>
</ItemTemplate>
<HeaderStyle Font-Names="Tahoma" />
</asp:TemplateField>
</Fields>
<FooterStyle BackColor="#CCCCCC" />
<HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
</asp:DetailsView>
</div>
C#
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
DataTable dt = new DataTable();
dt.Columns.AddRange(new DataColumn[] {
new DataColumn("StoreNumber"),
new DataColumn("FirstName"),
new DataColumn("LastName")
});
dt.Rows.Add(1, "David", "Morkel");
dt.Rows.Add(2, "Kevin", "Morkel");
detailsview1.DataSource = dt;
detailsview1.DataBind();
}
}
protected void OpenViewPdf_Command(object sender, CommandEventArgs e)
{
string storenumber = e.CommandArgument.ToString();
string popup = string.Format("window.open('http://ABC/files/{0}.pdf','_blank')", storenumber);
ScriptManager.RegisterStartupScript(this, this.GetType(), "key", popup, true);
}
VB
Protected Sub Page_Load(sender As Object, e As EventArgs)
If Not Me.IsPostBack Then
Dim dt As New DataTable()
dt.Columns.AddRange(New DataColumn() {New DataColumn("StoreNumber"), New DataColumn("FirstName"), New DataColumn("LastName")})
dt.Rows.Add(1, "David", "Morkel")
dt.Rows.Add(2, "Kevin", "Morkel")
detailsview1.DataSource = dt
detailsview1.DataBind()
End If
End Sub
Protected Sub OpenViewPdf_Command(sender As Object, e As CommandEventArgs)
Dim storenumber As String = e.CommandArgument.ToString()
Dim popup As String = String.Format("window.open('http://ABC/files/{0}.pdf','_blank')", storenumber)
ScriptManager.RegisterStartupScript(Me, Me.[GetType](), "key", popup, True)
End Sub
I hope this will help you out.