2016-12-01 6 views
1

リピーター内にボタンを置いて、クリックするテキストボックスをユーザーに表示する必要がありますが、ボタンのリストがあり、特定のボタンをクリックしていますボタンのテキストボックスは、そのボタン専用に開く必要があります。リピーターコントロールのボタンクリックイベントasp.netの同じリピーターにデータを表示するC#

現在、ボタンをクリックすると、すべてのテキストボックスがユーザーに表示されます。私は答えを見つけてい

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; 
     } 
} 
+0

これはあなたの最新デザインであることが見ているの場合と君たちはまだ捜しています。コード部分はどこですか? – Badiparmagi

+0

protected void lnkbtnreply_Click{ foreach(rptcomment.Items内のRepeaterItemアイテム) {パネルreplypic =(パネル)item.FindControl( "replypic"); パネルreplywrite =(パネル)item.FindControl( "replywrite"); replypic.Visible = true; replywrite.Visible = true;}} –

+1

コードで質問を編集すると、コメントはその目的のためのものではありません。 – Esko

答えて

1

:ここ

はコード....

<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 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; 
     } 
    } 
} 
+0

Thanx Nitin私は実際にここでコードを編集する方法を知らない –

+0

あなたの歓迎:)。さらに書式を設定するには、[こちらを読む](http://stackoverflow.com/editing-help) – Nitin

関連する問題