• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 267
  • 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.
  • 2
1 Solution
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
  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.
thiennhienAuthor Commented:
The data cannot be binded because I am using client side code (Javascript) to add the items dynamically. Thanks anyway.
Well, it really doesn't matter what you are using to get the data there.  As long as you call within that if statement

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

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