Solved

create table cells in javascript

Posted on 2016-08-13
6
86 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 56

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
MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

 

Author Comment

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

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
Although a lot of people devote their energy toward marketing for specific industries, there are some basic principles that can be applied to any sector imaginable. We’ll look at four steps to take and examine how those steps were put into action fo…
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn the basics of jQuery including how to code hide show and toggles. 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…

726 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