HIE GUYS
I USE VB 2008 and im a nubie...I HAVE A MASTER FORM WITH TEXTBOXES THAT INSERTS DATA INTO AN SQL 2005 DATABASE WHEN YOU CLICK "SAVE" THIS WORKED PERFECTLY BEFORE I INTRODUCED A LOOKUP TABLE(tblcountry) WHICH CONTAINS COUNTRIES IN THE DATABASE.
FIELDS IN TABLE
1)CODE ==========eg 1
2)DESCRIPTION=====eg Canada
so when i click save i nid the master form to insert "1" for canada into the MASTER DATABASE TO REPRESENT CANADA but it captures the selected country from the combo box"canada".
so how can i insert "1" for canada when the combo box displays canada
pliz pliz help i nid ideas
Loading
ShankeyPosted Jan 7, 2011, 9:12 AM
use dropdownlist control and bind in the following way:
DropDown.DataTextField = "DataTextField";
DropDown.DataValueField = "DataValueField";
DropDown.DataSource = dt;
DropDown.DataBind();
and then
while inserting use Convert.ToString(DropDown.SelectedValue);
hope it helped you..