Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7187033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:45:27+00:00 2026-05-28T18:45:27+00:00

I am creating an application, in which I am displaying the images(contained in a

  • 0

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.

here is my .aspx code

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

And the .cs code is as follows

  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:
    }

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 corresponding 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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T18:45:28+00:00Added an answer on May 28, 2026 at 6:45 pm

    Try this:

    TextBox txt =(TextBox)dtlist.FindControl("txt_image_name");
    txt.Text = edit_selected_image;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm creating an application in which a list of images will be displayed in
I am creating an application which produces some files/directories in my WebContent folder and
I am creating a Silverlight application which will be heavily javascripted against. To enable
I am creating an application of light in which i am displaying image of
I am creating application which is having functionality like 1 person can view video
I am creating one sample application in which i am reading database and displaying
I am creating an application which will expire after some particular time limit. means
When creating an application which needs to be capable of displaying a range of
I'm creating an application which will hold curriculum vitaes the user should be able
I'm creating an application which communicates with the device via FT2232H USB/RS232 converter. For

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.