elliottbenzle
asked on
Help adding link to item in grid view asp.net
My page looks like this: http://www.shatterboxwebdesign.com/slsdelete/admin_eenvelope_delete.aspx.htm
and the original is in asp.net. I want to change the "document" column so tat when the user clicks it will open the document in a new window. The code for the page is below, can someone who knows asp.net show me how to do this?
Thanks
<%@ Page Language="VB" MasterPageFile="~/admin_Ma sterPage.m aster" validateRequest="False" AutoEventWireup="false" CodeFile="admin_eenvelope_ delete.asp x.vb" Inherits="admin_eenvelope_ delete" title="" Debug="true" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head " Runat="Server">
<script type="text/javascript">
if (document.images) {
img1 = new Image();
img1.src = "images/delete_button_on.p ng";
}
</script>
<script type="text/javascript" language="javascript">
function DeleteConfirmation()
{
if (confirm("Are you sure, you want to delete selected records ?")==true)
return true;
else
return false;
}
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Cont entPlaceHo lder1" Runat="Server">
<asp:Label ID="Message" runat="server" Text=""></asp:Label>
<span class="style1">Delete eEnvelope Items</span><br /><br />
<div align="center">
<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False "
DataSourceID="SqlDataSourc e1"
ShowFooter="true">
<Columns>
<asp:TemplateField HeaderText="Delete?" ShowHeader="true" HeaderStyle-HorizontalAlig n="Center" HeaderStyle-Width="80px" ItemStyle-HorizontalAlign= "Center">
<ItemTemplate>
<asp:CheckBox ID="chkSelect" runat="server" />
</ItemTemplate>
<FooterTemplate>
<asp:ImageButton ID="btnDelete" runat="server" ImageUrl="~/images/delete_ button_off .png" OnClick="btnDelete_Click" OnClientClick="return DeleteConfirmation();"/>
<script type="text/javascript" charset="utf-8">
$(document).ready(function (){
$('#ctl00_ContentPlaceHold er1_GridVi ew1_ctl03_ btnDelete' ).hover(
function(){ // Change the input image's source when we "roll on"
$(this).attr({ src : 'images/delete_button_on.p ng'});
},
function(){ // Change the input image's source back to the default on "roll off"
$(this).attr({ src : 'images/delete_button_off. png'}); }
);
});
</script>
</FooterTemplate>
</asp:TemplateField>
<asp:BoundField DataField="id"
HeaderText="ID"
SortExpression="id"
HeaderStyle-Width="200px"
ItemStyle-HorizontalAlign= "Center" />
<asp:BoundField DataField="doc_loc"
HeaderText="Document"
SortExpression="doc_loc"
HeaderStyle-Width="200px"
ItemStyle-HorizontalAlign= "Center" />
</Columns>
<HeaderStyle BackColor="#99CCFF" />
<AlternatingRowStyle BackColor="#99CCFF" Wrap="False" />
</asp:GridView>
</div>
<br />
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:stluke %>"
SelectCommand="SELECT [id], [doc_loc] FROM [elliott_tod10].[eenvelope ]"></asp:S qlDataSour ce>
<br />
<br />
<%-- %><asp:ImageButton id="btnDelete" runat="server" ImageUrl="~/images/delete_ event_off. png" OnClick="btnDelete_Click" />
<script type="text/javascript" charset="utf-8">
$(document).ready(function (){
$('#ctl00_ContentPlaceHold er1_ImageB utton1').h over(
function(){ // Change the input image's source when we "roll on"
$(this).attr({ src : 'images/delete_event_on.pn g'});
},
function(){ // Change the input image's source back to the default on "roll off"
$(this).attr({ src : 'images/delete_event_off.p ng'}); }
);
});
</script> --%>
<br />
<%-- <input type="image" name="add_event" id="add_event" src="images/add_event_off. png" runat="server"> --%>
</asp:Content>
and the original is in asp.net. I want to change the "document" column so tat when the user clicks it will open the document in a new window. The code for the page is below, can someone who knows asp.net show me how to do this?
Thanks
<%@ Page Language="VB" MasterPageFile="~/admin_Ma
<asp:Content ID="Content1" ContentPlaceHolderID="head
<script type="text/javascript">
if (document.images) {
img1 = new Image();
img1.src = "images/delete_button_on.p
}
</script>
<script type="text/javascript" language="javascript">
function DeleteConfirmation()
{
if (confirm("Are you sure, you want to delete selected records ?")==true)
return true;
else
return false;
}
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Cont
<asp:Label ID="Message" runat="server" Text=""></asp:Label>
<span class="style1">Delete eEnvelope Items</span><br /><br />
<div align="center">
<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False
DataSourceID="SqlDataSourc
ShowFooter="true">
<Columns>
<asp:TemplateField HeaderText="Delete?" ShowHeader="true" HeaderStyle-HorizontalAlig
<ItemTemplate>
<asp:CheckBox ID="chkSelect" runat="server" />
</ItemTemplate>
<FooterTemplate>
<asp:ImageButton ID="btnDelete" runat="server" ImageUrl="~/images/delete_
<script type="text/javascript" charset="utf-8">
$(document).ready(function
$('#ctl00_ContentPlaceHold
function(){ // Change the input image's source when we "roll on"
$(this).attr({ src : 'images/delete_button_on.p
},
function(){ // Change the input image's source back to the default on "roll off"
$(this).attr({ src : 'images/delete_button_off.
);
});
</script>
</FooterTemplate>
</asp:TemplateField>
<asp:BoundField DataField="id"
HeaderText="ID"
SortExpression="id"
HeaderStyle-Width="200px"
ItemStyle-HorizontalAlign=
<asp:BoundField DataField="doc_loc"
HeaderText="Document"
SortExpression="doc_loc"
HeaderStyle-Width="200px"
ItemStyle-HorizontalAlign=
</Columns>
<HeaderStyle BackColor="#99CCFF" />
<AlternatingRowStyle BackColor="#99CCFF" Wrap="False" />
</asp:GridView>
</div>
<br />
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:stluke %>"
SelectCommand="SELECT [id], [doc_loc] FROM [elliott_tod10].[eenvelope
<br />
<br />
<%-- %><asp:ImageButton id="btnDelete" runat="server" ImageUrl="~/images/delete_
<script type="text/javascript" charset="utf-8">
$(document).ready(function
$('#ctl00_ContentPlaceHold
function(){ // Change the input image's source when we "roll on"
$(this).attr({ src : 'images/delete_event_on.pn
},
function(){ // Change the input image's source back to the default on "roll off"
$(this).attr({ src : 'images/delete_event_off.p
);
});
</script> --%>
<br />
<%-- <input type="image" name="add_event" id="add_event" src="images/add_event_off.
</asp:Content>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Still needs a little tweeking, but this helped. Thanks.
<ItemTemplate>
<asp:HyperLink ID="hlLink" runat="server" ="<%# Eval("doc_loc") %>" navigateurl="path to be browsed" target="_blank"></asp:Hype
</ItemTemplate>
</asp:TemplateField>
or
<asp:TemplateField HeaderText="Document">
<ItemTemplate>
<asp:HyperLink ID="hlLink" runat="server" ="<%# Eval("doc_loc") %>" onclientclick="javascript:
</ItemTemplate>
</asp:TemplateField>