Selecti one value in combox then other values placed in it disappears automatically ?

Discussion in 'C#' started by ManiRai, May 12, 2010.

  1. #1
    when i select one value in combox then other values placed in it disappears automatically.
    I don't know what the problem is i have also checked its value member and display member they both are correct..


    I want suggestion please help...
     
    ManiRai, May 12, 2010 IP
  2. bibinsmk

    bibinsmk Active Member

    Messages:
    205
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #2
    Your question is not clear. I think you place some code in the page load event. When you select a value in the combobox the load event again working and you details are erased. If this is the case place the code in a not postback block.
     
    bibinsmk, May 12, 2010 IP
  3. ManiRai

    ManiRai Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    my question is that when i select one value in combobox then the other values which are binded to combobox disappears automatically as I have placed combobox code in page load event and other than page load event where should i post the code for combobox.
     
    ManiRai, May 12, 2010 IP
  4. bibinsmk

    bibinsmk Active Member

    Messages:
    205
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    53
    #4
    Put your sample code here
     
    bibinsmk, May 14, 2010 IP
  5. ManiRai

    ManiRai Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    This code i am using on page_load
    obj.FillComboBox(cmbSupplier, "select * from Suppliers_tbl", "Name", "Supplier_ID");
    cmbSupplier.Text = "--Select--";

    this code is on combox selected index changed
    obj.FillComboBox(cmbSupplier, "select * from Suppliers_tbl where Supplier_ID=" + cmbSupplier.SelectedValue, "Name", "Supplier_ID");
     
    ManiRai, May 15, 2010 IP
  6. vihutuo

    vihutuo Well-Known Member

    Messages:
    1,511
    Likes Received:
    34
    Best Answers:
    0
    Trophy Points:
    180
    #6
    Why do you need to fill the combo box in the selected index changed event? That is causing the problem
     
    vihutuo, May 17, 2010 IP
  7. ManiRai

    ManiRai Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #7
    thnks dear for sorting out my problem it is working now
     
    ManiRai, May 17, 2010 IP