Skip to content Skip to sidebar Skip to footer

Create Row With Java Script But Its Gone On My Asp Panel

I have asp panel to show some register form detail for user to complete the form , when i generate row with my script , its gone when i try to hide my panel , i mean when table ro

Solution 1:

This problem arises because you've misunderstood the ASP.NET life cycle. When you have a postback to the server (for example, after clicking ButtonNext), any client side changes that you've made will disappear, and the page is regenerated from the server and sent to the client.

There's several ways to get around this:

  1. You can use server side code to add new rows. This is the least efficient but easiest method.

  2. You can detect on the server by reading the posted form values how many rows were added and what their values were, then recreate them on the server and send them back as part of the response.

  3. You can eliminate postbacks and use client side JavaScript to do showing/hiding of the panel. I like this style best because it's the most efficient use of resources, and you don't have both client and server side trying to manipulate the DOM.

Post a Comment for "Create Row With Java Script But Its Gone On My Asp Panel"