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 !




Command Name of Hyperlink in DataList C#


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




<asp:DataList ID="dlSearch" runat="server" Width="613px" Field="TrainerId" OnItemCommand="dlSearch_ItemCommand" OnSelectedIndexChanged="dlSearch_SelectedIndexChanged1" Font-Names="Verdana" Font-Size="10pt">
<HeaderTemplate>
<table>
<tr>
<td>
<asp:Label ID="Label2" runat="server" Text="Name"></asp:Label>
</td>
<td>
<asp:Label ID="Label5" runat="server" Text="Contact"</asp:Label>
</td>
</tr>
</table>
</HeaderTemplate>
<ItemTemplate>
<table>
<tr>
<td>
<asp:LinkButton ID="lnkName" runat="server" CommandName="TName" Text='<%# DataBinder.Eval(Container.DataItem,"Name") %>'></asp:LinkButton>
</td>
<td>
<%# DataBinder.Eval(Container.DataItem,"Mobile") %>
</td>
</tr>
<tr>
<td>
<asp:Label ID="TraId" runat="server" Visible="false" Text=' <%# DataBinder.Eval(Container.DataItem,"TId") %>'></asp:Label>
</td>
</tr>
</table>
<hr />
</ItemTemplate>
</asp:DataList><br />


CommandName of Hyperlink can be now used here in


protected void dlSearch_ItemCommand(object source, DataListCommandEventArgs e)
{
if (e.CommandName == "TrainerName")
{
Label lnk1 = (Label)e.Item.FindControl("TraId");
string key =lnk1.Text;
Response.Redirect("Default.aspx?id="+ key);

}
}




Responses

Author: pradipta    18 Aug 2008Member Level: Gold   Points : 1
The command name should be "TName" instead of "TrainerName"
if (e.CommandName == "TName").......


Feedbacks      
Popular Tags   What are tags ?   Search Tags  
Hyperlink in Database . Database Hyperlink . CommandName of Hyperlink in DataList . Command Na  .  Hyperlink in Database  .  Database Hyperlink  .  CommandName of Hyperlink in DataList  .  Command Name of Hyperlink in DataList  .  Command Name  .  

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: conversion of datagrid view to excel format
Previous Resource: Data in Grid view in Descending. Order
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