C# 按钮单击中继器控件中的事件,以在asp.net c中显示同一中继器中的数据#
我在中继器中有一个按钮,用户可以看到它的点击文本框,但我有一个按钮列表,点击特定的按钮文本框应该只为该按钮打开 当前,当我单击按钮时,用户可以看到所有文本框 这是代码C# 按钮单击中继器控件中的事件,以在asp.net c中显示同一中继器中的数据#,c#,asp.net,repeater,C#,Asp.net,Repeater,我在中继器中有一个按钮,用户可以看到它的点击文本框,但我有一个按钮列表,点击特定的按钮文本框应该只为该按钮打开 当前,当我单击按钮时,用户可以看到所有文本框 这是代码 <asp:Repeater ID="rpt"> <div align="right" id="reply"> <asp:LinkButton ID="lnkbtnreply" OnClick="lnkbtnreply_Click" Text="Reply
<asp:Repeater ID="rpt">
<div align="right" id="reply">
<asp:LinkButton ID="lnkbtnreply" OnClick="lnkbtnreply_Click" Text="Reply"></asp:LinkButton>
</div>
<asp:TextBox ID="" placeholder="Enter Your Reply Here" Visible="false">
</asp:TextBox>
</asp:Repeater>
我找到了答案。如果你们还在搜索它,看看: 下面是隐藏的代码:
protected void lnkbtnreply_Click(object sender, EventArgs e)
{
foreach (RepeaterItem item in rptcomment.Items)
{
Panel replypic = (Panel)item.FindControl("replypic");
Panel replywrite = (Panel)item.FindControl("replywrite");
replypic.Visible = true; replywrite.Visible = true;
}
}
protected void rptcomment_ItemCommand(object source, System.Web.UI.WebControls.RepeaterCommandEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
Panel replypic = (Panel)e.Item.FindControl("replypic");
Panel replywrite = (Panel)e.Item.FindControl("replywrite");
if (e.CommandName == "img_Click") // check command is cmd_delete
{
// get you required value
string CustomerID = (e.CommandArgument).ToString();
replypic.Visible = true;
replywrite.Visible = true;
}
}
}
这是你的设计。代码部分在哪里?受保护的void lnkbtnreply_Click(对象发送方,事件参数e){foreach(rptcoment.Items中的repertItem){Panel replypic=(Panel)item.FindControl(“replypic”);Panel replywrite=(Panel)item.FindControl(“replywrite”);replypic.Visible=true;replywrite.Visible=true;}用代码编辑你的问题,评论不是为了这个目的。Thanx Nitin我真的不知道如何编辑这里的代码(欢迎:)。有关进一步的格式设置帮助,您可以