michael1174
asked on
Reference the selected value in a drop down list in c# ASP.NET
How do I reference the selected value in a drop down list? I need to use that value to populate a textbox:
Here is my sql string that I am building:
strSQL = "SELECT T1T1DS " +
"FROM XGGNDCT.ZHT1DF00 " +
"WHERE T1T1CD = '" + ddlInsuredOperations value + "'";
After I run the sql, I would reference the field:
txtInsuredOperations.Text = dr4["T1T1DS"].ToString();
Thanks in advance...
Here is my sql string that I am building:
strSQL = "SELECT T1T1DS " +
"FROM XGGNDCT.ZHT1DF00 " +
"WHERE T1T1CD = '" + ddlInsuredOperations value + "'";
After I run the sql, I would reference the field:
txtInsuredOperations.Text = dr4["T1T1DS"].ToString();
Thanks in advance...
You can use ddlInsuredOperations.Text
ASKER
I get error:
'System.Web.UI.WebControls .DropDownL ist' does not contain a definition for 'Text'
'System.Web.UI.WebControls
Post the code where you are calling ddInsuredOperations.Text.
ASKER
strSQL = "SELECT T1T1DS " +
"FROM XGGNDCT.ZHT1DF00 " +
"WHERE T1T1CD = '" + ddlInsuredOperations.Text + "'";
ASKER
I just tried ddlInsuredOperations.Selec tedItem.Va lue and that looks like its working for me.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.