473,651 Members | 2,580 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to add several HTML elements to the web page dynamically using AJAX

ton
Hi,

I'm using AJAXPRO this works very well.

What I want to do is to add new page elements at my web site without using a
postback. And I do not mean listitems but a complete dialog. Let me give an
example:

in my application which will contain of several pages I'll use a
filter/query mechanism, so if the user wants to add a new filter or modify
an existing one I would like to:
1) run a AJAXPRO server function
2) the result will be (?) several elements generated via vb code, and added
on the website
it could be some elements like
- a panel
- several labels with text on
- several textboxes
- several check boxes
- a listbox
- a view buttons
(- if possible an extra scrip block)

all code will use AJAXPRO functions to get and set the data

is this possible?
And is it easy to do.

My alternative is that i add all these controls to my webpage in a panel and
make this panel hidden, the disadventage is that i would have to include
this panel in more webpages, which will cause maintenance in the future.

Thanx

Ton

Aug 22 '08 #1
3 2406
it looks like you want the feature supplied by the update panel in the .net
ajax toolkit. you can do it with any ajax library (have server generate html
javascript inserts into the dom). also look at jquery which is client
concenteric and allows creating control from javascript.

-- bruce (sqlwork.com)
"ton" wrote:
Hi,

I'm using AJAXPRO this works very well.

What I want to do is to add new page elements at my web site without using a
postback. And I do not mean listitems but a complete dialog. Let me give an
example:

in my application which will contain of several pages I'll use a
filter/query mechanism, so if the user wants to add a new filter or modify
an existing one I would like to:
1) run a AJAXPRO server function
2) the result will be (?) several elements generated via vb code, and added
on the website
it could be some elements like
- a panel
- several labels with text on
- several textboxes
- several check boxes
- a listbox
- a view buttons
(- if possible an extra scrip block)

all code will use AJAXPRO functions to get and set the data

is this possible?
And is it easy to do.

My alternative is that i add all these controls to my webpage in a panel and
make this panel hidden, the disadventage is that i would have to include
this panel in more webpages, which will cause maintenance in the future.

Thanx

Ton

Aug 22 '08 #2
ton
Is it? Is it possible to add dynamically controls in the update panel at
runtime? If so then it is easy, but can a script with several function to
the page as well ?

I did not know that. How can that be established?

The controls, I supoose can be added via the contenttemplate of the update
panel (why didn't I think of it), but what about the script can it be added
to the page at runtime? But how is this done?.

thanx
ton
"bruce barker" <br*********@di scussions.micro soft.comschreef in bericht
news:29******** *************** ***********@mic rosoft.com...
it looks like you want the feature supplied by the update panel in the
.net
ajax toolkit. you can do it with any ajax library (have server generate
html
javascript inserts into the dom). also look at jquery which is client
concenteric and allows creating control from javascript.

-- bruce (sqlwork.com)
"ton" wrote:
>Hi,

I'm using AJAXPRO this works very well.

What I want to do is to add new page elements at my web site without
using a
postback. And I do not mean listitems but a complete dialog. Let me give
an
example:

in my application which will contain of several pages I'll use a
filter/query mechanism, so if the user wants to add a new filter or
modify
an existing one I would like to:
1) run a AJAXPRO server function
2) the result will be (?) several elements generated via vb code, and
added
on the website
it could be some elements like
- a panel
- several labels with text on
- several textboxes
- several check boxes
- a listbox
- a view buttons
(- if possible an extra scrip block)

all code will use AJAXPRO functions to get and set the data

is this possible?
And is it easy to do.

My alternative is that i add all these controls to my webpage in a panel
and
make this panel hidden, the disadventage is that i would have to include
this panel in more webpages, which will cause maintenance in the future.

Thanx

Ton

Aug 22 '08 #3
ton
i 've made some test:
a simple form with the scriptmanager and the updatepanel
after clicking the button the next sub is called:

Protected Sub Button1_Click(B yVal sender As Object, ByVal e As
System.EventArg s)
Dim but As New Button
but.Text = "YES !!"
but.ID = "x"
but.Attributes( "onclick") = "alert('pushed' );"
AddHandler but.Click, AddressOf Me.Button1_Clic k
UpdatePanel1.Co ntentTemplateCo ntainer.Control s.Add(but)
Dim Textbox1 As New TextBox
Textbox1.Text = "and a new textbox !"
Textbox1.ID = "xx"
UpdatePanel1.Co ntentTemplateCo ntainer.Control s.Add(Textbox1)
End Sub
without the post back I see the other button and the textbox is also
appearing, but when pushing it both controls are gone? There is a postback
but the procedure is not executed because (I guess) the postback is "not
complete" the added button is not added now, thats why the added addhandler
which should bring it back again is not fired.
With or without the addhandler is the same result.
The pushed messagebox is working (the alert is fired), button at time still
visible but after clicker the alert the button and the textbox are gone.

How can this be corrected, is there a way to read the state of de website
which controls should be "active"
thanks

ton
"ton" <to*@nospam.nls chreef in bericht
news:77******** *************** ****@cache5.til bu1.nb.home.nl. ..
Is it? Is it possible to add dynamically controls in the update panel at
runtime? If so then it is easy, but can a script with several function to
the page as well ?

I did not know that. How can that be established?

The controls, I supoose can be added via the contenttemplate of the update
panel (why didn't I think of it), but what about the script can it be
added to the page at runtime? But how is this done?.

thanx
ton
"bruce barker" <br*********@di scussions.micro soft.comschreef in bericht
news:29******** *************** ***********@mic rosoft.com...
>it looks like you want the feature supplied by the update panel in the
.net
ajax toolkit. you can do it with any ajax library (have server generate
html
javascript inserts into the dom). also look at jquery which is client
concenteric and allows creating control from javascript.

-- bruce (sqlwork.com)
"ton" wrote:
>>Hi,

I'm using AJAXPRO this works very well.

What I want to do is to add new page elements at my web site without
using a
postback. And I do not mean listitems but a complete dialog. Let me
give an
example:

in my application which will contain of several pages I'll use a
filter/query mechanism, so if the user wants to add a new filter or
modify
an existing one I would like to:
1) run a AJAXPRO server function
2) the result will be (?) several elements generated via vb code, and
added
on the website
it could be some elements like
- a panel
- several labels with text on
- several textboxes
- several check boxes
- a listbox
- a view buttons
(- if possible an extra scrip block)

all code will use AJAXPRO functions to get and set the data

is this possible?
And is it easy to do.

My alternative is that i add all these controls to my webpage in a panel
and
make this panel hidden, the disadventage is that i would have to include
this panel in more webpages, which will cause maintenance in the future.

Thanx

Ton

Aug 22 '08 #4

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

Similar topics

22
7951
by: Saul | last post by:
I have a set of radio buttons that are created dynamically, after rendered I try loop thru this set by getting the length of the set, but I keep getting an error stating the element is undefined. I am using getElelementsByName since these are radio buttons, but it seems that the dynamic element is not seen!!! This is my code... please let me know if there is anything that I am doing wrong! - thanks ---- ....
2
1917
by: pamelafluente | last post by:
Hi dears, I have a plain HTML page. I want to render it a little interactive. I was thinking to add to it 1 script and events to the elements I want to make interactive. Then, I need to talk with an ASP.NET page which would actually do some processing on the server. Processing may include a replace (regeneration) of the above HTML page, for further interaction.
1
2463
by: AndiSmith | last post by:
Hi guys, I wondered if anyone could help me with this problem, or even shed some light on the direction I need to take to resolve it? I'm using .NET 2.0 (C# flavor) to build a large user-based website. I've created an AJAX based user control, which is dynamically placed on a page (once, or multiple times) if the user has the correct permissions to receive it. It contains two drop down lists - employee value and partner value; and a...
2
1517
by: Jeff Allan | last post by:
Hello, I am trying to load an external HTML page into a DIV tag with .NET 05 and I can't figure it out. Any suggestions? My Scenario: - Gridview populated with list of available files - I can get the external page to load in a new window just fine - I would like the detail to show on the same page, below the list. - I can't use the detail control and dynamically create the page as these
2
1810
by: sarafat | last post by:
greetings people I am new to Ajax and javascript, yet i have little time to learn it all. Question is: i am using javascript to create my DOM Table and AJAX that returns a DataSet to my Javascript to fill information in the table. Code looks like this: <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
1
3235
by: MORALBAROMETER | last post by:
Hi all, I want to update MULTIPLE elements of an HTML page using Ajax. for this reason i my response is an xml document. I want to use XSL at the client side to update these elements. How can i achieve this? I will be very greatefull for any help. Have a look below ===================================================== Response from Server using HttpRequest Object =====================================================
3
6352
by: SMH | last post by:
Normally an SVG document is loaded/parsed/interpreted inside an HTML document using an 'object' (or 'embed') element, although there are supposedly other ways too. The problem is, the SVG document must be static this way. I want to use the DOM interface to build SVG dynamically inside an HTML document. I am guessing I can build it inside HTML within an 'object' (or maybe 'iframe'?) element. My intentions/goals:
10
1400
by: chadsspameateremail | last post by:
I first should list my background and that is that I'm new to PHP. I would like to be able to have an HTML form where there is a list that you choose from. Depending on what item is chosen in the list different HTML is displayed somewhere else on the page. I know this might be possible by adding a submit button and reloading the page. But is there a way to do it without the submit button? I know that Java might be able to accomplish...
0
8349
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
8275
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
8795
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...
1
8460
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8576
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
7296
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4281
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1906
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1585
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.