cache or delay postback?

R

Rubble

Hello,

Ive placed a server control button on my aspx page. Ive created some
client side script that Ive tied to the onclick action of this button.
The script adds to a listbox the contents of a textbox. It works
very well, but the page does a postback, and the listbox resets
itself.

The listbox has to be a server control, so I cant create this whole
scenario using your basic client side javascript.


How can I stop the postback...or cache it for later...or in some way
keep the page from reloading? Can I build an html button and tie the
server listbox control to it?

Any ideas would be appreciated.

Thank!
B. Rubble
 
R

Rubble

Rajesh.V said:
Add return false; after your js tied to onClick. This should arrest the
postback. If you want the added items to persist then the same shud be added
to a hidden text box and added to the list whenever the postback happens.



That sounds easy enough! Thanks for the suggestion, Ill try it out
later. I thought that it would have to be some asp.net setting since
a server button control would always post back to the server, no
matter what the action was it performed.

On a similar note...can anyone show me how to get values from an html
control on the code behind? If I place the values in a hidden text
box, Ill have to pull them when I process the page. I know how to do
this in old asp...but how do I do it in asp.net?

thanks again!
 
R

Rajesh.V

Add return false; after your js tied to onClick. This should arrest the
postback. If you want the added items to persist then the same shud be added
to a hidden text box and added to the list whenever the postback happens.
 
R

Rajesh.V

After u place the htmlcontrol, right click and choose run as server control.
Then you can access the same in code behind.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top