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
  1. Home
  2. Web Development
  3. ASP.NET
  4. Urgent listbox values in Server side.

Urgent listbox values in Server side.

Scheduled Pinned Locked Moved ASP.NET
questionjavascriptdatabasesysadmintutorial
3 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.
  • J Offline
    J Offline
    jayarajmrj
    wrote on last edited by
    #1

    I have moved the values from one listbox to another listbox by using Javascript. How can I reterive the values from the second listbox in server side ie., code behind? Because i will store the selected values in DB. Assume that the First listbox ------------- Raja Jayaraj Meena Rupa Kannan Radha I Moved the Meena , Kannan to Second Listbox Second Listbox ------------- Meena Kannan In Add_Click I have to assign the values in a string in comma separation For example string m_Names; m_Names=Meena,Kannan;

    L 1 Reply Last reply
    0
    • J jayarajmrj

      I have moved the values from one listbox to another listbox by using Javascript. How can I reterive the values from the second listbox in server side ie., code behind? Because i will store the selected values in DB. Assume that the First listbox ------------- Raja Jayaraj Meena Rupa Kannan Radha I Moved the Meena , Kannan to Second Listbox Second Listbox ------------- Meena Kannan In Add_Click I have to assign the values in a string in comma separation For example string m_Names; m_Names=Meena,Kannan;

      L Offline
      L Offline
      Lucky Sheikh
      wrote on last edited by
      #2

      hey guy just use the datareader and insert add the item of one listbox like dim dr as dataadapter cmd.commandtext="select ur datatable" dr.open dr=cmd.executereader dr.read listbox2.text=add.item("datacolumnname") dr.close lucky

      M 1 Reply Last reply
      0
      • L Lucky Sheikh

        hey guy just use the datareader and insert add the item of one listbox like dim dr as dataadapter cmd.commandtext="select ur datatable" dr.open dr=cmd.executereader dr.read listbox2.text=add.item("datacolumnname") dr.close lucky

        M Offline
        M Offline
        mani_iips
        wrote on last edited by
        #3

        The above method doesnt looks to be efficient. Since it will call for a postbacl each time... Try this. Listbox sends "all" the selected values as postback to the server side. This hint is enough to get the job done [:)]. So what u need to do is... 1.. before form submit, u need to selecte all the items in the listbox from which u want to read the values. (this will be done in javascript) 2...string str = Request.Form["MySelectedListBox"] 3... "str" will contain "values" of al the items as csv. 4.. string []selectedItems = str.split(','); 5...foreach(string strItem in selectedItems) { //Insert into database. } Please grade the reply.. in case it helped you. Thanks.

        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