Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

create table cells in javascript

Posted on 2016-08-13
6
Medium Priority
?
124 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 60

Accepted Solution

by:
Julian Hansen earned 2000 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

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

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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

971 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