Solved

create table cells in javascript

Posted on 2016-08-13
6
81 Views
Last Modified: 2016-08-22
i have a table in asp
 <table id="mytable" width="100%" cellspacing="2" cellpadding="0" runat="server">
                    <tr>
                        <td></td>
                    </tr>
            </table>


and i am creating 3 cells in javascript but on postback this cells are removed
how to maintain them??
0
Comment
Question by:pamela rizk
  • 3
  • 2
6 Comments
 
LVL 12

Expert Comment

by:funwithdotnet
ID: 41755189
You'll have to recreate them after the post back.
0
 

Author Comment

by:pamela rizk
ID: 41755234
k thank you
0
 
LVL 55

Accepted Solution

by:
Julian Hansen earned 500 total points
ID: 41756164
To explain further.

When your code runs on the server it produces HTML output which is sent to the browser. At this point your server code ceases to exist - as far as the browser is concerned - only the resulting HTML / CSS / JavaScript is relevant.
This runs in the browser independently of the server code. Anything done by JavaScript is invisible to server code UNLESS the JavaScript tells the server what it has done by means of a callback - usually using AJAX.
When you postback to the server - the only information sent to the server is the information that the server setup in the first place. If you modified this in the browser with JavaScript - the server has no way of knowing that you did this - unless you tell it.

If you modify the view with JavaScript and you postback to the server then if you want to see the modifications
a) You have to pass this information back to the server - either in the Post Back or in an AJAX call
b) The server will need to use this information to render out the new content when it sends back its response.
2
Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

 

Author Comment

by:pamela rizk
ID: 41758890
thank you mr julian as usual for your good explanation everytime
0
 
LVL 55

Expert Comment

by:Julian Hansen
ID: 41758908
You are welcome.
0
 

Author Closing Comment

by:pamela rizk
ID: 41766364
this is the best explanation ever
0

Featured Post

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question