How To Access HTML elements in code behind???

Discussion in 'Software' started by nedums_b, Feb 7, 2008.

  1. nedums_b

    nedums_b

    Joined:
    Feb 7, 2008
    Messages:
    1
    Hi,

    I'm trying to access HTMl elements in code behind in .net 2. but couldnt find a way yet.

    Could any one please help me to acces an iframe in code behind.

    in my case i have seperated code behinds from the projects and placed in different project.
    i'm trying to add aspx pages into sharepoint.

    my aspx files is
    <%@ Page Language="C#" MasterPageFile="_catalogs/masterpage/TestF_Sitespan2.master" Inherits="MyTest.Reports" Title="Test" %>

    this doesnt has a CodeFile attribute set.

    in my code behind
    i have

    public partial class Reports : stem.Web.SessionState.IRequiresSessionState
    {
    protected HtmlForm Form1;
    protected TextBox TextBox1;
    protected System.Web.UI.HtmlControls.HtmlGenericControl rptFrame;


    }
    and

    public partial class Reports : System.Web.UI.Page
    {
    string FRAME_SRC = "http://www.yahoo.com";
    protected override void OnInit(EventArgs e)
    {
    base.OnInit(e);
    }
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void OnChanged(object sender, EventArgs e)
    {
    TextBox1.Text = "AAAAAA";
    HtmlControl rptFrame = (HtmlControl)this.Form1.FindControl("rptFrame");
    rptFrame.Attributes["src"] = "http://www.google.com";// String.Format("myIinfoPage.aspx?id={0}", selection);

    }
    }

    Here I can access an asp.net web control (Textbox)
    but couldnt access the iframe.
    even when i debug the code i noticed the form too had a null value in the code .

    Any idea about accessing form or html elements from the code behind.

    Could any one please let me know how to access this


    Thanks
    Ned
    nedums_b, Feb 7, 2008
    #1
    1. Advertising

  2. nedums_b

    ProgTalk

    Joined:
    Dec 4, 2007
    Messages:
    12
    Did you make sure all things are server controls?
    ProgTalk, Feb 7, 2008
    #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. Corbin O'Reilly
    Replies:
    2
    Views:
    3,123
    Corbin O'Reilly
    May 26, 2004
  2. BobS
    Replies:
    0
    Views:
    476
  3. Colin D

    Elements 3 v. Elements 2

    Colin D, Nov 25, 2004, in forum: Digital Photography
    Replies:
    29
    Views:
    554
  4. Eric Babula

    Photoshop Elements/Premiere Elements

    Eric Babula, Jul 6, 2005, in forum: Digital Photography
    Replies:
    35
    Views:
    826
    ASAAR
    Jul 28, 2005
  5. Monima
    Replies:
    0
    Views:
    1,743
    Monima
    Dec 14, 2010
Loading...

Share This Page