Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. Web Development
  3. ASP.NET
  4. listbox loading from database

listbox loading from database

Scheduled Pinned Locked Moved ASP.NET
javascriptdatabase
7 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Vinay Dornala
    wrote on last edited by
    #1

    Hi, I have source and destination listboxes and button , Click on selected items are moved from source to destination i did this thing with javascript it is working fine, There is one button that is get postback, so that the selected items from source listbox. both listboxes are populated again from database. how do we stop reloading listbox from database again

    I S 2 Replies Last reply
    0
    • V Vinay Dornala

      Hi, I have source and destination listboxes and button , Click on selected items are moved from source to destination i did this thing with javascript it is working fine, There is one button that is get postback, so that the selected items from source listbox. both listboxes are populated again from database. how do we stop reloading listbox from database again

      I Offline
      I Offline
      Imran Khan Pathan
      wrote on last edited by
      #2

      You can use return statement in javascript and return false if you dont want postback.

      please don't forget to vote on the post that helped you.

      1 Reply Last reply
      0
      • V Vinay Dornala

        Hi, I have source and destination listboxes and button , Click on selected items are moved from source to destination i did this thing with javascript it is working fine, There is one button that is get postback, so that the selected items from source listbox. both listboxes are populated again from database. how do we stop reloading listbox from database again

        S Offline
        S Offline
        Sandeep Akhare
        wrote on last edited by
        #3

        Might be the reasone behind it is you are populating the listbox on every postback just check Ispostback property when page is first time loaded populate listbox else no need to populate listbox again, if viewstate is enabled.

        Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

        modified on Thursday, February 07, 2008 8:39:15 AM

        V 1 Reply Last reply
        0
        • S Sandeep Akhare

          Might be the reasone behind it is you are populating the listbox on every postback just check Ispostback property when page is first time loaded populate listbox else no need to populate listbox again, if viewstate is enabled.

          Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

          modified on Thursday, February 07, 2008 8:39:15 AM

          V Offline
          V Offline
          Vinay Dornala
          wrote on last edited by
          #4

          Hi sandeep, This is the code i have written in page_load When i click on button page get postback, and the code inside if is not executed as said but listbox2 items which i have selected from listbox1 is lost. If Not Page.IsPostBack Then Dim months1() As String = {"January", "February", "March", "April", "May", "June", "July"} Dim months2() As String = {"a", "b", "c", "d"} Me.ListBox1.DataSource = months1 Me.ListBox1.DataBind() ListBox2.DataSource = months2 ListBox2.DataBind() End If Thanks in advance

          S 1 Reply Last reply
          0
          • V Vinay Dornala

            Hi sandeep, This is the code i have written in page_load When i click on button page get postback, and the code inside if is not executed as said but listbox2 items which i have selected from listbox1 is lost. If Not Page.IsPostBack Then Dim months1() As String = {"January", "February", "March", "April", "May", "June", "July"} Dim months2() As String = {"a", "b", "c", "d"} Me.ListBox1.DataSource = months1 Me.ListBox1.DataBind() ListBox2.DataSource = months2 ListBox2.DataBind() End If Thanks in advance

            S Offline
            S Offline
            Sandeep Akhare
            wrote on last edited by
            #5

            Check viewstate of your page <%@ Page Language="C#" EnableViewState="true" should be true

            Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

            V 1 Reply Last reply
            0
            • S Sandeep Akhare

              Check viewstate of your page <%@ Page Language="C#" EnableViewState="true" should be true

              Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

              V Offline
              V Offline
              Vinay Dornala
              wrote on last edited by
              #6

              yes it true, still iam refeshing listboxes

              S 1 Reply Last reply
              0
              • V Vinay Dornala

                yes it true, still iam refeshing listboxes

                S Offline
                S Offline
                Sandeep Akhare
                wrote on last edited by
                #7

                Now i don't know whats happening wrong there might be at application level the viewstate is false.

                Thanks and Regards Sandeep If If you look at what you do not have in life, you don't have anything, If you look at what you have in life, you have everything... "

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups