javascript - asp.net programmatically get text inside dynamic div -


i'm trying text of div on creating dynamically in asp.

below example of html table created datagrid:

<table border="1" id="maincontent_dgvalues" style="border-collapse:collapse;">     <tbody><tr>         <td>date modified<td>comment</td><td></td>     </tr><tr>         <td>3/26/2000</td><td id="myedit" onclick="makeeditable()">my text</td><td><a href="javascript:__dopostback('ctl00$maincontent$dgvalues$ctl03$ctl00','')">update</a></td>     </tr><tr>     </tr> </tbody></table> 

this code have div created dynamically:

 <script >       function makeeditable() {          var divtag = document.createelement("div");          divtag.setattribute("id", "editdiv");          divtag.setattribute("runat", "server");          divtag.setattribute("contenteditable", "true");          var s = document.getelementbyid("myedit").innerhtml;          document.getelementbyid("myedit").innerhtml = "";          var mytext = document.createtextnode(s)          divtag.appendchild(mytext);          document.getelementbyid('myedit').appendchild(divtag);          document.getelementbyid('myedit').removeattribute("onclick");      }      </script>   

this creates contenteditable div inside td says my text

once update on table clicked, wish grab text within div in code:

    protected void dgvalues_editcommand(object source, datagridcommandeventargs e)     {             // div text here     } 

please help.

since div client-side only, cannot pass backend code. can on update click first catch client-side click event , copy content of div hidden field. when form posts - content of hidden field available server-side code.


Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -