TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Kavita Pharde
NA
44
79.1k
how to redirect to page on click of button in repeater
Jun 26 2013 3:45 AM
hi i want to post comments on click of comment button i used command name for this purpose but its not working
can anyone tell me why this is not working
below is my code:
<asp:Repeater ID="Repeater1" runat="server"
OnItemCommand="Repeater1_ItemCommand">
<HeaderTemplate>
<table>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td align="right" width="10%" style="vertical-align: top;">
<asp:Image runat="server" CssClass="content_img" ID="Image1" ImageUrl='<%# Eval("ImgName") %>' />
</td>
<td style="width: 80%" valign="top">
<table style="border-bottom: 1px dashed #999; width: 85%">
<tr>
<td colspan="3" class="ribbon left_ribbon">
<asp:Label ID="Label2" runat="server"><%# Eval("PostedBy") %></asp:Label>
</td>
</tr>
<tr>
<td class="Title articleLink">
<a href="Article.aspx?id=<%# Eval("ArticleId") %> &Caterory=<%# Eval("Category") %>">
<%# Eval("Title") %></a>
</td>
</tr>
<tr>
<td>
<%# Eval("Details") %>
</td>
</tr>
<tr>
<td class="name">
<%# Eval("AuthorName")%>
</td>
</tr>
<tr>
<td>
<asp:Button ID="btnLike" runat="server" Text="Like" CommandName="Like" CssClass="button" />
<asp:Button ID="btnComment" runat="server" Text="Comment" CommandName="Comment" CssClass="button"/>
<asp:Button ID="btnShare" runat="server" Text="Share" CommandName="Share" CssClass="button" />
<asp:Label ID="lblPostDate" runat="server"><%# Eval("PostDate")%></asp:Label>
</td>
</tr>
<tr>
<td colspan="2">
<asp:Rating ID="Rating1" runat="server" EmptyStarCssClass="Empty" MaxRating="5" FilledStarCssClass="Filled"
ReadOnly="true" AutoPostBack="true" StarCssClass="ratingItem" WaitingStarCssClass="Saved">
</asp:Rating>
</td>
</tr>
</table>
<br />
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
codebehind:
protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
{
if (e.CommandName == "Like")
{
foreach (RepeaterItem item in Repeater1.Items)
{
}
}
else if (e.CommandName == "Comment")
{
foreach (RepeaterItem item in Repeater1.Items)
{
Button btn = item.FindControl("btnComment") as Button;
btn.PostBackUrl = "Comment.aspx";
}
}
else if (e.CommandName == "Share")
{
}
}
Reply
Answers (
4
)
close current browser tab in asp.net without using javascrip
Asp.net Image Slide Question