Adding value to TextBox inside Datalist ItemTemplate
<p>Friends, i have a problem regarding textbox values inside a datalist...
Actualy i am creating an application, in which i am displaying the images(contained in a folder) in a datalist... Each datalist cell is having a ImageButton(clicking on which will show large pic of the image), a delete button(clicking which will delete the image), a edit button and a textbox.....clicking on the edit button will cause the imagefile name to get displayed in the textbox....</p>

<p>here is my .aspx code

</p>

<pre class="lang-html prettyprint-override"><code>     &lt;asp:DataList ID="dtlist" runat="server" RepeatColumns="4" CellPadding="5" EnableViewState="True"&gt;
      &lt;ItemTemplate&gt;
            &lt;asp:ImageButton Width="100" ID="ImagePic" ImageUrl='&lt;%# Container.DataItem %&gt;' CommandName='&lt;%# Container.DataItem %&gt;' runat="server" OnClick="ImagePic_Click" ImageAlign="Top"&gt;
            &lt;/asp:ImageButton&gt;
      &lt;br /&gt;
            &lt;asp:Button Width="100" ID="btn_image_del" CommandName='&lt;%# Container.DataItem %&gt;' runat="server" Text="Delete" OnClick="btn_image_del_Click"&gt;    
            &lt;/asp:Button&gt;
      &lt;br /&gt;
            &lt;asp:TextBox ID="txt_image_name" Width="100" runat="server" Visible="True" Text='&lt;%# Container.DataItem %&gt;' MaxLength="500" /&gt;
            &lt;/asp:TextBox&gt;
            &lt;asp:Button Width="100" ID="btn_image_edit" CommandName='&lt;%# Container.DataItem %&gt;' runat="server" Text="Edit" OnClick="btn_image_edit_Click"&gt;
            &lt;/asp:Button&gt;
      &lt;/ItemTemplate&gt;
      &lt;ItemStyle BorderColor="Brown" BorderStyle="dotted" BorderWidth="3px" HorizontalAlign="Center" VerticalAlign="Bottom" /&gt;
    &lt;/asp:DataList&gt;
</code></pre>

<p>And the .cs code is as follows
</p>

<pre class="lang-cs prettyprint-override"><code>  protected void BindDataList()//shows the pics from the user folder
    {
            string[] list = Directory.GetFiles(Server.MapPath("/Candidate_Pics/" + Convert.ToString(Session["Sex"]) + "/" + txt_u_name.Text + "/"));
            var aList = from fileName in Directory.GetFiles(Server.MapPath("/Candidate_Pics/" + Convert.ToString(Session["Sex"]) + "/" + txt_u_name.Text + "/"))
                        select string.Format("/Candidate_Pics/" + Convert.ToString(Session["Sex"]) + "/" + txt_u_name.Text + "/{0}", Path.GetFileName(fileName));
            dtlist.DataSource = aList;
            dtlist.DataBind();
    }

  protected void ImagePic_Click(object sender, ImageClickEventArgs e)
    {
        string strImage = ((ImageButton)sender).CommandName;
        ViewState["InsertedURL"] = strImage;
        ScriptManager.RegisterStartupScript(Page, typeof(Page), "ShowValidation", "javascript:ShowPic();", true);
        Large_Pic.ImageUrl = strImage;
    }

  protected void btn_image_del_Click(object sender, EventArgs e)
    {
        string del_selected_image = ((Button)sender).CommandName;
        File.Delete(Server.MapPath(del_selected_image));
    }

  protected void btn_image_edit_Click(object sender, EventArgs e)
    {
        string edit_selected_image = Path.GetFileName(((Button)sender).CommandName);
        // Now what should i do:
    }
</code></pre>

<p>the above three function namely ImagePic_Click,btn_image_del_Click, btn_image_edit_Click are working fine..Deletion, then LargePic view are all working perfectly, my problem is that, i want that when the edit button will be clicked, the corresponding name of the image will be displayed in the Datalist textbox...in the just above function, edit_selected_image is holding the filename of the corressponding image...i have tested it by applying breakpoints......now the problem is that i want this value should be passed to the textbox "txt_image_name" in the Datalist. Please anybody, help me regarding this matter</p>
