PC Review


Reply
Thread Tools Rate Thread

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

 
 
ton
Guest
Posts: n/a
 
      22nd Aug 2008
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

 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      22nd Aug 2008
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
>
>

 
Reply With Quote
 
ton
Guest
Posts: n/a
 
      22nd Aug 2008
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" <(E-Mail Removed)> schreef in bericht
news:29F22628-A96A-4947-B1CF-(E-Mail Removed)...
> 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
>>
>>


 
Reply With Quote
 
ton
Guest
Posts: n/a
 
      22nd Aug 2008
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(ByVal sender As Object, ByVal e As
System.EventArgs)
Dim but As New Button
but.Text = "YES !!"
but.ID = "x"
but.Attributes("onclick") = "alert('pushed');"
AddHandler but.Click, AddressOf Me.Button1_Click
UpdatePanel1.ContentTemplateContainer.Controls.Add(but)
Dim Textbox1 As New TextBox
Textbox1.Text = "and a new textbox !"
Textbox1.ID = "xx"
UpdatePanel1.ContentTemplateContainer.Controls.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" <(E-Mail Removed)> schreef in bericht
news:77193$48aedeb8$541ef063$(E-Mail Removed)...
> 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" <(E-Mail Removed)> schreef in bericht
> news:29F22628-A96A-4947-B1CF-(E-Mail Removed)...
>> 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
>>>
>>>

>


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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
.Net 2.0 / AJAX / Dynamically adding controls to the page Rob Meade Microsoft ASP .NET 4 22nd Feb 2007 10:08 AM
creating a html page dynamically in VB.NET Skumar Microsoft Dot NET Framework Forms 0 3rd Mar 2005 09:52 AM
Can I dynamically load html page into my aspx page? Earl Teigrob Microsoft ASP .NET 5 4th Mar 2004 06:37 PM
Dynamically changing the HTML in a page. SGA Smele Microsoft ASP .NET 3 19th Dec 2003 08:04 PM
using mshtml to access HTML page elements Taylor Microsoft C# .NET 1 9th Dec 2003 02:19 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:39 AM.