Solved

create table cells in javascript

Posted on 2016-08-13
6
60 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 51

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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

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

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

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Envision that you are chipping away at another e-business site with a team of pundit developers and designers. Everything seems, by all accounts, to be going easily.
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn how to dynamically set the form action using jQuery.
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…

747 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now