In this post I will explain about How to open in new tab or window in Asp.net gridview
This is the simplest way to add hyperlink to gridview
Previous Post I was Explained about the Nested GridView in ASP.NET Using c# with show/hide jQuery - Allow Alphanumeric (Alphabets & Numbers) Characters in Textbox using JavaScript , Fileupload show selected file in label when file selected , Check for file size with JavaScript before uploading , Asp.Net AjaxFileUpload Control With Drag Drop And Progress Bar.
Sample Gridview
<asp:gridview ID="bookslist" runat="server"> <Columns> <asp:TemplateField ItemStyle- horizontalAlign="Center"> <ItemTemplate> <asp:HyperLink id="lnkDetails" runat="server" Target="_blank" NavigateUrl="~/BookDetail.aspx">Details</asp:HyperLink> </ItemTemplate> <asp:TemplateField> </Columns> </asp:gridview >
<a href="http://www.google.com" target="_BLANK">Google.com</a>
This will open a link in a new tab without leaving the current browser you are using.
<asp:HyperLink ID="sahyadri" runat="server" onClick="window.open('http://www.sahyadri.com/about.aspx', 'mywindow','width=800,height=400,toolbar=yes,location=yes, directories=yes,status=yes,menubar=yes,scrollbars=yes,copyhistory=yes, resizable=yes')" Text="About" Width="80px"></asp:HyperLink>
Comments
Post a Comment