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