Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > General Computer Discussion > Software > How To Access HTML elements in code behind???

Reply
Thread Tools

How To Access HTML elements in code behind???

 
 
nedums_b nedums_b is offline
Junior Member
Join Date: Feb 2008
Posts: 1
 
      02-07-2008
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
 
Reply With Quote
 
 
 
 
ProgTalk ProgTalk is offline
Junior Member
Join Date: Dec 2007
Posts: 28
 
      02-07-2008
Did you make sure all things are server controls?
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
How to assign csssytle attribute to html elements through code? Zdenko Rupcic ASP .Net 2 09-25-2006 01:22 PM
Html code cleaner - Powerful HTML Code Compression Tool heren ASP .Net 1 09-14-2005 12:39 PM
to add elements in html form, this code works but... ojvm Javascript 4 06-24-2005 02:10 PM
HTML code warnings in asp.net html code view Craig Kenisston ASP .Net 3 10-07-2004 04:05 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57