• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 269
  • Last Modified:

keep dropdown list items when postback...tricky part--items added through client side!

Hello everyone.  I have a server dropdown list in asp.net page.  I added the items dynamically through client side code.  If I want to keep the values during postback...how would I be able to do that? Thanks.
0
thiennhien
Asked:
thiennhien
  • 2
1 Solution
 
TorrwinCommented:
I'm going out on a limb and assuming you're using ASP.NET.

If you are, you would add the following to your page load sub:

 If Not IsPostBack Then
            FillAndBindDROP_DOWN_LIST_NAME()
  End If

I made a subroutine to bind the data to my ddl, and just call it through that.  

Basically, you just want to put your binding code inside the "If not IsPostBack" statement.
0
 
thiennhienAuthor Commented:
The data cannot be binded because I am using client side code (Javascript) to add the items dynamically. Thanks anyway.
0
 
TorrwinCommented:
Well, it really doesn't matter what you are using to get the data there.  As long as you call within that if statement
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now