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 6555999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T12:53:19+00:00 2026-05-25T12:53:19+00:00

My GridView Markup: <asp:GridView ID=GrdVw visible=False runat=server AllowPaging=True AutoGenerateColumns=False> <Columns> <asp:BoundField DataField=Title HeaderText=Title />

  • 0

My GridView Markup:

<asp:GridView ID="GrdVw" visible="False" runat="server" AllowPaging="True" 
    AutoGenerateColumns="False">
    <Columns>
        <asp:BoundField DataField="Title" HeaderText="Title" />
        <asp:BoundField DataFi

eld="Comment" HeaderText="Comment" />

            <asp:TemplateField HeaderText="Review Document">
                <ItemTemplate>

                <asp:Image ID="currentDocFile" runat="server" />
            </ItemTemplate>
            <EditItemTemplate>
                <asp:FileUpload ID="reviewDoc_UpldFl" runat="server" />
            </EditItemTemplate>
        </asp:TemplateField>
        <asp:CommandField ShowEditButton="True" />
        <asp:CommandField ShowDeleteButton="True" />
    </Columns>
</asp:GridView>

My Bind Method that I call from Page_Load and after Cancelling/Updating, etc:

    private void BindGrdVw()
    {
        List<ArticleComments> commentsList = ArticleCommentsBLL.GetComments(ArticleID);
        if (cruiseReviewsList.Count != 0)
        {
            GrdVw.DataSource = commentsList;
            GrdVw.DataKeyNames = new string[] { "ID" };
            GrdVw.DataBind();
            GrdVw.Visible = true;
        }
     } 

..Now as you see I have a template field, I access the ‘FileUpload’ control in the EditTemplate by ‘FindControl()’ of the row that I’m editing. but how can I access the ‘Image’ control’s property ‘ImageUrl’.

I need to set it to something like the following, this is a sample code from another project in the code behind file but I was able to access the image directly.

currentProfilePic_Img.ImageUrl = ConfigurationManager.AppSettings["cruisesPpUploadPath"].ToString() + currentCruise.ProfilePic;

*The AppSettings returns the path for the folder that I use for uploading.

*currentCruise is an object and it’s properties was assigned through my DAL layer.

  • 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-25T12:53:19+00:00Added an answer on May 25, 2026 at 12:53 pm

    I think I understand what you’re trying to do…

    If you want to bind the image control URL dynamically, you will have to hook into the RowDataBound event of the GridView.

    <asp:GridView ID="GrdVw" visible="False" runat="server" AllowPaging="True" 
        AutoGenerateColumns="False" OnRowDataBound="GrdVwDataBound">
    
    protected virtual void GrdVwDataBound(GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            var imageControl = e.Row.FindControl("currentDocFile") as Image;
            imageControl.ImageUrl = // Image URL here
        }
    }
    

    Hope this helps!

    More info here:

    http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.onrowdatabound.aspx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Markup <asp:GridView ID=GridView1 runat=server AutoGenerateColumns=False> <Columns> <asp:BoundField DataField=insured_first_name HeaderText=First Name /> <asp:BoundField DataField=insured_first_name HeaderText=Middle
Markup: <asp:GridView ID=GridView1 runat=Server> <Columns> <asp:BoundField DataField=status_column HeaderText=Status /> <asp:BoundField ... <asp:BoundField ... </Columns>
I have a gridview like below: <asp:GridView DataKeyNames=TransactionID AllowSorting=True AllowPaging=TrueID=grvBrokerage runat=server AutoGenerateColumns=False CssClass=datatable Width=100%
I have a GridView defined like this: <asp:GridView ID=myGridView ruant=server> <asp:BoundField DataField=myField /> <asp:CommandField
I'm displaying a GridView using the following markup in my default.aspx : <Columns> <asp:BoundField
I have a gridview with the following markup: <asp:GridView ID=gv runat=server Width=700px skinid=gridview HeaderStyle-HorizontalAlign=Left
I have defined the following in my gridview markup (simplified): <asp:GridView ID=grvReport runat=server DataSourceID=odsReport
<asp:GridView runat=server id=GrdVw_Download> <RowStyle cssclass=ItemStyle /> <HeaderStyle cssclass=tableheader horizontalalign=Left /> <AlternatingRowStyle cssclass=AlternateItemStyle horizontalalign=Left />
I have an ASP.NET GridView which has columns that look like this: | Foo
For displaying data in our application I've use GridView with the following markup: <asp:GridView

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.