473,508 Members | 2,382 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="javascript>

function UpdateDivTag(){

document.getElementId("divtagid").innerHTML = "oh no Hello world"

}


<button name="somebuttonname" onClick="UpdateDivTag()">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 1560
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 "FindControl" 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 HtmlTextWriterTag. 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.HtmlControls;
your tag in the webpage
<DIV ID="BigDiv"></DIV>


then you can reference your DIV tag.


In the C# code behind;


BigDiv.InnerHtml = Server.HtmlEncode("THIS IS IT ");

BigDiv.InnerHtml = "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
7214
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...
7
3711
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 :...
10
7305
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
2521
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...
0
7115
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...
0
7321
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,...
0
7377
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...
1
7036
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
5047
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...
0
4705
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...
0
3191
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1547
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 ...
1
762
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.