Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Updating data in a dropdownlist in asp.net

Status
Not open for further replies.

AppzDev

MIS
Oct 9, 2002
57
US
I have a quick question which i'm sure is something simple that in my limited experience is missing.

I have a page that displays a person's demographic information. There are 3 dropdown lists, all work the same, which get populated when the page is loaded with the TEXT of the practice that was chosen when the person was originally entered in the page.

If you were to look at the demographic table in the database, the value is stored in the "practice_id" field.

This is my question. I have every field updating when i choose to update the page, except those 3 dropdown list fields, all of which store the values, not the text, in the demographic table.

I am assuming it has something to do with the sqlparameters i am using. I have found nothing on the internet on how exactly to go about this.

Here is the code i use to update the dropdown lists.

cmd.Parameters.Add(New SQLParameter("@practice", practice.selecteditem.value))
cmd.Parameters.Add(New SQLParameter("@provider", provider.selecteditem.value))
cmd.Parameters.Add(New SQLParameter("@insurance", insurance.selecteditem.value))

I am not sure about the "selecteditem.value" piece.

If anyone knows something i may be able to try, please let me know or point me in the direction of somewhere that may help me along.

I also should mention that this dropdown is not a part of a datagrid.

Thanks again!

dc~
 
ddl_list1.SelectedItem.Value is the right syntax for getting the value of dropdown list.... can I see what you are doing to populate the dropdownlist originally... which is where I suspect your issue is
 
I am not sure what exactly i did, but this seems to be working now. I redid the code on the page and everything works fine. Go figure. I didn't add anything new, i just took some extra time to logically put the code in the order in which i thought it should run and it worked after that.

Thanks for your help, it's appreciated in more ways than you know!

dc~
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top