C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Open new Window using DataGrid C#


Posted Date: 23 Aug 2008    Resource Type: Code Snippets    Category: DataGridView
Author: TamannaMember Level: Silver    
Rating: Points: 8



Following code will create a label in HeaderTemplate and a Hyperlink in ItemTeplate. By clicking on dat link a new window can be open. But as datagrid will shown only when it has data so hyperlink can be used to shown some data from db.


<asp:DataGrid ID="DataGrid1" runat="server" AutoGenerateColumns="false" Width="100%" OnItemCommand="DataGrid1_ItemCommand1" OnSelectedIndexChanged="DataGrid1_SelectedIndexChanged1" Height="181px">
<Columns>
<asp:TemplateColumn>
<HeaderTemplate>
<asp:Label ID="Label1" runat="server" Text="New Window"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:HyperLink ID="HyperLink1" runat="server">Hyperlink</asp:HyperLink>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>


Follwing script code should be shown under Head Tag.
<script type="text/javascript">
function fun()
{
var detailsWindow;
detailsWindow=window.open(myurl,"dfd","width=400,height=350, menubar,resizable ");
detailsWindow.focus();
return false;
}






Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Using DataGrid C#  .  Open  .  New Window  .  

Post Feedback


This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
You must Sign In to post a response.
Next Resource: Checkbox column checkall uncheckall in DataGrid C#
Previous Resource: Gridview Sorting and Paging
Return to Discussion Resource Index
Post New Resource
Category: DataGridView


Post resources and earn money!
 
Related Resources



dotNet Slackers   BizTalk Adaptors    Web Design


Contact Us    Privacy Policy    Terms Of Use