C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Resources » Code Snippets » DataGridView »

Open new Window using DataGrid C#


Posted Date: 23 Aug 2008    Resource Type: Code Snippets    Category: DataGridView
Author: TamannaMember Level: Silver    
Rating: 1 out of 5Points: 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  
Sign In to add 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!
 
More Resources



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use