c# - call a method in code-behind from client side script -
i'm using asp.net.
i want update part of page (not whole page) without sending page request server. want in client side.
for this, think should use ajax
, javascript
.
i've created handler page: handler.ashx
i send request , response in plain text:
javascript
xmlhttprequest.open("get", url); //applyupdate function response in client side. xmlhttprequest.onreadystate = applyupdate; xmlhttprequest.send(null);
code on handler.ashx
response.write("plain text response");
now in applyupdate function can use plain text , show in client browser.
but problem this:
i have placeholder1 control in asp.net:
<asp:placeholder id="placeholder1" runat="server"></asp:placeholder>
how can assign plain text (the response !) label control , add label placeholder1
control !? mean how can use these codes in client side:
label lb1 = new lable(); lb1.text = plaintext; placeholder1.controls.add(lb1);
these codes in c#
(code-behind) how can use such these codes? cannot same thing javascript
codes !
excuse bad explanation.
i'll appreciate help.
create element in javascript using response text , append placeholder. if placeholder used explicitly label, can remove , append parent.
this how create element: https://developer.mozilla.org/en-us/docs/dom/document.createelement
Comments
Post a Comment