Click here to Skip to main content
15,884,838 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi in my project one drop down is der.while selecting from dropdown and am clicking search button so its records display in text box fields..when i delete reocrd.and from drop down selected item still shows.??
can any one suggest me how to refresh i mean after deleting that value from drop down should delte
Posted

Bind that drop down again by same method by which you bind first.
or
Call same method again by which you bind dropdown.
Thanks
 
Share this answer
 
v2
Comments
ythisbug 24-May-12 6:43am    
u mean to say in delete button click also have to call dat bind dropdown?
ythisbug 24-May-12 6:44am    
i tried but its not happening
I hope this link may help you
http://forums.asp.net/t/1317231.aspx[^]
 
Share this answer
 
Comments
Maciej Los 24-May-12 8:50am    
Good link, 5!
akee seth 24-May-12 9:22am    
thanks :)
if you are using any function to populate/bind the drop down list, then call the same function again at the click event of the delete button.
eg.

C#
protected void btnDelete_Click(object sender, EventArgs e)
    {
        deleteData();
        dropdownlist1.items.clear();
        bind_DataToDropDown();

    }
 
Share this answer
 
v2
Hi ,
You have to Rebind it again
C#
ddl.DataSource = null;
      ddl.DataTextField = "";
      ddl.DataValueField = "";
      ddl.DataBind();


Best Regards
M.Mitwalli
 
Share this answer
 
Comments
ythisbug 24-May-12 6:52am    
no its not working
Mohamed Mitwalli 24-May-12 7:16am    
can you share your code
Mohamed Mitwalli 24-May-12 7:16am    
make sure it's already deleted from DataBase
Hello ,

Bind the Dropdownlist again after deleted the element from dropdownlist.
dropdownlist.databind();
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900