473,602 Members | 2,751 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Updating the html inside a panel

How can I update the html inside of a panel?

How can I make this code work

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

<script runat="server">

protected void Button1_Click(o bject sender, EventArgs e)
{
Panel1.innerHTM L = "<html>Hell o World!!!<html>" ; //This will not
work.
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitl ed Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Panel ID="Panel1" runat="server" Height="144px" Style="z-index:
100; left: 64px;
position: absolute; top: 48px" Width="256px">
Say Hello</asp:Panel>
<asp:Button ID="Button1" runat="server" OnClick="Button 1_Click"
Style="z-index: 102;
left: 104px; position: absolute; top: 200px" Text="Button"
Width="176px" />

</div>
</form>
</body>
</html>
Jan 12 '07 #1
4 15526
Hi,

Flyguy wrote:
How can I update the html inside of a panel?

How can I make this code work

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

<script runat="server">

protected void Button1_Click(o bject sender, EventArgs e)
{
Panel1.innerHTM L = "<html>Hell o World!!!<html>" ; //This will not
work.
}
</script>
A Panel is rendered on the client by a DIV. You can see that by viewing
the HTML source sent to the client, always a good idea when something is
not working properly.

Since the Panel is a DIV, you may not use the "html" tags again, as they
are already present in the document.

HTH,
Laurent
--
Laurent Bugnion [MVP ASP.NET]
Software engineering: http://www.galasoft-LB.ch
PhotoAlbum: http://www.galasoft-LB.ch/pictures
Support children in Calcutta: http://www.calcutta-espoir.ch
Jan 12 '07 #2
You could use a Literal instead of a panel and set the Text property of the
literal;

MyLiteral.Text = "<p>Hello world</p>";

"Flyguy" <fl****@nospam. nospamwrote in message
news:14******** *************** ***********@mic rosoft.com...
How can I update the html inside of a panel?

How can I make this code work

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

<script runat="server">

protected void Button1_Click(o bject sender, EventArgs e)
{
Panel1.innerHTM L = "<html>Hell o World!!!<html>" ; //This will not
work.
}
</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitl ed Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Panel ID="Panel1" runat="server" Height="144px"
Style="z-index:
100; left: 64px;
position: absolute; top: 48px" Width="256px">
Say Hello</asp:Panel>
<asp:Button ID="Button1" runat="server" OnClick="Button 1_Click"
Style="z-index: 102;
left: 104px; position: absolute; top: 200px" Text="Button"
Width="176px" />

</div>
</form>
</body>
</html>

Jan 12 '07 #3
Hi flyguy,

I can see your intension is to mark the "Hello World!!!" as html, therefore
you enclosed it in tag "<html></html>".

First, innerHTML is not a server-side property, it's a client-side property
(http://msdn2.microsoft.com/en-us/library/ms533897.aspx). You can use any
html source to set to this property, for example: <h1>Hello World!!!</h1>.
However, "<html></html>" is also a valid html tag which normally used in
the most outside of the html source.

To set the html inside the Panel at server-side, you can create a literal
control with the html source and add the control to the Panel:

LiteralControl lc = new LiteralControl( "<h1>Hello World!!!</h1>");
panel1.Controls .Add(lc);
To set the html inside the Panel at client-side, you can use:

<%@ Page Language="C#" AutoEventWireup ="true" CodeFile="Defau lt.aspx.cs"
Inherits="_Defa ult" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dt d">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitl ed Page</title>
<script type="text/javascript" language="javas cript">
function test()
{
var panel2 = document.getEle mentById('panel 2');
panel2.innerHTM L = "<h1>Hello JavaScript!!!</h1>";
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Panel ID="panel1" runat="server"> </asp:Panel>
<asp:Panel ID="panel2" runat="server"> </asp:Panel>
<input type="button" onclick="test() " value="test" />
</div>
</form>
</body>
</html>
Hope this helps.

Sincerely,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Jan 12 '07 #4
Hi Flyguy,

I'm not sure about your question. Would you please depict more? Thanks.

Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Jan 12 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
1883
by: Jay | last post by:
Hi all, May i know if there is any way by which we can render a given HTML inside .NET Windows Forms? We had the Web Browser controls in Visual Studio 6. Is there a follow-up of that in VS.NET? Most recently, HTML rendered dialog boxes seemms to be in vogue. Can anyone please help?
0
288
by: shustes | last post by:
Hi, I'm trying to essentially replicate a process that I had working well in classic ASP. I dump records within an HTML table to the web page. Within each record are textboxes and/or radio buttons and/or checkboxes for data entry. I want to process the entire page in one post. I've managed to create a Panel control and add the web controls to
2
3512
by: Amrit | last post by:
Hi Can anyone help me? I would really appreciate I am trying to scroll Groupboxes inside the panel when i hold panel's scroll bar and drag up and down. Such as Internet explorer where you can hold the scroll bar and drag up down which causes the material to move at the same time up and down Thank Amrit.
1
1506
by: google | last post by:
Hi, Is there a way I can use html inside input box? I am making a autocomplete box and need to group tags visual (by appling similar color)... Abdul
1
2921
chunk1978
by: chunk1978 | last post by:
hi there... i have a rather complex HTML form (involving hundreds of lines of Javascript, etc.) and i'd like to know if it's possible to embed HTML inside a Flash frame (or the like)... thanks
3
9306
by: ma | last post by:
Hello, I have two update Panel in my page. I want to update one of these update panels from another one. How can I do this? How can I force the whole page to be updated from a button inside an update panel? Regards
1
1844
by: BillGatesFan | last post by:
This is probably my second time using a GridView control and I cannot not figure out how to display HTML inside a datacolumn. Can somehow help me? I would be very surprised if it cannot be done. I want to display an image with a link to it in a data column For example: <a href='http://www.google.com'><img src='http://..../icon.jpg'
1
2679
by: rahullko05 | last post by:
Can anybody help me? to write one line code to render html inside a div element. Thanks.
0
7993
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
8401
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
8404
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
8268
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...
0
5440
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
3944
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2418
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
1
1510
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1254
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.