473,666 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C#.net equivalent of getelementid

3 New Member
in Javascript i can update <div> innerHTML with simple code

<script type="text/javascript" language="javas cript>

function UpdateDivTag(){

document.getEle mentId("divtagi d").innerHTM L = "oh no Hello world"

}


<button name="somebutto nname" onClick="Update DivTag()">Some button"</button>

does anyone know how to do this from a C# code behind page.

I am using Visual Studio 2005 and one of my includes is

using System.Windows. Form;

Also using quite a few others. Can't seem to find a document model or HTMLDocument to find a function to this.

Shane.
Mostly irritated.
Sep 6 '07 #1
5 1570
Plater
7,872 Recognized Expert Expert
In the code behind you should know all your elements already.
If not, there is a control finder, it's pretty hard to find, being called "FindContro l" and all.

Expand|Select|Wrap|Line Numbers
  1. this.FindControl("mycontrolname");
  2.  
Sep 6 '07 #2
Shane807
3 New Member
I can use the FindControl to find the element that isn't a proble. The problem is filling in the innerhtml to alter a DIV component. I am looking to use HtmlTextWriterT ag. Not sure.
Sep 12 '07 #3
Plater
7,872 Recognized Expert Expert
If you want stuff inside a DIV tag, create the element type you want and then .Add() it to the div's object.
Sep 12 '07 #4
Shane807
3 New Member
Figured it out. Not apparent. You need

using System.Web.UI.H tmlControls;
your tag in the webpage
<DIV ID="BigDiv"></DIV>


then you can reference your DIV tag.


In the C# code behind;


BigDiv.InnerHtm l = Server.HtmlEnco de("THIS IS IT ");

BigDiv.InnerHtm l = "This works too";


The tag name will not show up in the Visual Studio GUI, but you can reference it just like this. Either everyone knew that and I'm slow or you learned something new. Thanks for your help.
Sep 12 '07 #5
Plater
7,872 Recognized Expert Expert
if you used ASP:Panel (which translates into a DIV) and used runat="server" it would show up in the intellisense (ctrl+spacebar)
Sep 12 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

14
7276
by: John | last post by:
Is there an equivalent of COM on Linux that I can get through Python. My need is to have some sort of language independent component framework. I can think of CORBA but I have to have a server running. I prefer not to. I just need Python components for local consumption in other languages. I remember Gnome libs having some thing like this. Any thoughts?
7
3724
by: Tim Conner | last post by:
Hi, I am an ex-delphi programmer, and I having a real hard time with the following simple code (example ): Which is the equivalent to the following code ? var chars : PChar; sBack, s : String;
10
7326
by: karch | last post by:
How would this C# contruct be represented in C++/CLI? Or is it even possible? PolicyLevel level = (enumerator->Current) as PolicyLevel; Thanks, Karch
14
2541
by: grid | last post by:
Hi, I have a certain situation where a particular piece of code works on a particular compiler but fails on another proprietary compiler.It seems to have been fixed but I just want to confirm if both statements are similar : *((char **)v)++ == *((char **)v++) Where v is a pointer to an array of characters,defined as char *v;
0
8445
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8356
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8871
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8781
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8640
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6198
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5664
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4369
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2771
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.