Referencing nested server-side IDs

Discussion in 'ASP .Net' started by King Coffee, Nov 18, 2009.

  1. King Coffee

    King Coffee Guest

    Hi,

    I need help in referencing nested server-side IDs. I have an asp:GridView
    ID="GridView1" control. The columns tag contains an asp:Image ID="Image1"
    control. How can I set the Image1 ImageUrl attribute in the codebehind file
    ?

    King
    King Coffee, Nov 18, 2009
    #1
    1. Advertising

  2. On Nov 18, 10:14 am, "King Coffee" <> wrote:
    > Hi,
    >
    > I need help in referencing nested server-side IDs. I have an asp:GridView
    > ID="GridView1" control. The columns tag contains an asp:Image ID="Image1"
    > control. How can I set the Image1 ImageUrl attribute in the codebehind file
    > ?
    >
    > King


    Use RowDataBound event
    http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowdatabound.aspx

    void CustomersGridView_RowDataBound(Object sender,
    GridViewRowEventArgs e)
    {

    if(e.Row.RowType == DataControlRowType.DataRow)
    {
    Image img = e.Row.FindControl("Image1") as Image;
    img.ImageUrl = "...";
    }

    }
    Alexey Smirnov, Nov 18, 2009
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?R2FyZGFy?=

    Referencing a Server Side xml-stylesheet

    =?Utf-8?B?R2FyZGFy?=, Dec 6, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    333
    =?Utf-8?B?R2FyZGFy?=
    Dec 6, 2004
  2. Mythran
    Replies:
    2
    Views:
    497
    Mythran
    Jan 22, 2005
  3. Thor
    Replies:
    1
    Views:
    1,001
    Mikkel Heisterberg
    Jul 2, 2003
  4. Replies:
    2
    Views:
    693
    Beat Bolli
    Jun 21, 2005
  5. =?Utf-8?B?QW1yaXQgS29obGk=?=

    getting element IDs from nested standard forms in JavaScript

    =?Utf-8?B?QW1yaXQgS29obGk=?=, Jan 25, 2007, in forum: ASP .Net
    Replies:
    8
    Views:
    513
    Laurent Bugnion [MVP]
    Jan 26, 2007
Loading...

Share This Page