Last post Oct 19, 2006 02:33 AM by Gatorzlair
Sep 26, 2006 02:49 AM|Gatorzlair|LINK
Here is what I am attempting to do:
1 dropdownlist wich displays 3 selections, back up to a database table with 3 fields: Brand; Email_To, Email_CC
I need to on the selection of the band retrieve the value of both the To and CC fields to use in emailing the contents of the form.
I am using VWD, I am fairly comfortable with beginner(hack) coding, but I am not sure how to pull the information. I have attempted to use 2 SQLDataSource controls and attempted to filter and assign the values to both variables and textbox contorls with
little luck. I am not sure what the syntax should be. I am programing in Visual Basic, any help and/or points in the right direction are greatly appreciated.
Sep 26, 2006 03:24 AM|Jasson_king|LINK
Do you want to bind Brand to a dropdownlist and get To and CC fields from database through the selected brand of the dropdownlist?
If yes,I give you the following example code.
SqlConnection sqlCnn = new SqlConnection(connectionstring);
string strSQL = "select Email_To, Email_CC from Table where Brand="+dropdownlist.SelectedItem.Text;
SqlCommand sqlCmd = new SqlCommand(strSQL,sqlCnn);
SqlDataReader dr = sqlCmd.ExecuteReader();
string email_to = dr["Email_To"].ToString();
string email_cc = dr["Email_CC"].ToString();
Sep 26, 2006 04:40 AM|Gatorzlair|LINK
Sep 26, 2006 06:08 AM|Gatorzlair|LINK
I have the DDL configured to pull the "To" and "CC" fields so the SqlDataSource has all the information that I need is there any way to asign the values of the fields to a variable from the dropdownlist Control. It appears that it only deals with two values
SelectedItem and SelectedValue but the Datasource has 3 values retirved is ther any way I can tap this to get that third value? Here is the code I have so far, and I believe I need a VB code solution, I have attempted to mix code on the page but it always
seems to turn out horribally wrong.
ConnectionString="<%$ ConnectionStrings:CCI_BackendConnectionString %>"
ProviderName="<%$ ConnectionStrings:CCI_BackendConnectionString.ProviderName %>"
SelectCommand="SELECT [Brand], [Email_To], [Email_CC] FROM [tbl_Public_Relations_Email]WHERE([Brand]=?)"
Sep 26, 2006 06:49 AM|Jasson_king|LINK
No matter what programming language you are using,it is impossible to get three field values from a dropdownlist.You can only get the other filed values through one field value from dropdownlist. For example,you can write a method to do so.
Sep 26, 2006 06:57 AM|PeterBrunone|LINK
I don't suppose you'd be interested in something like
EasyListBox for this...?
Oct 19, 2006 02:33 AM|Gatorzlair|LINK
While this is close it is not quite what I need to accomplish. If it were to Selectedvalues then it would be perfect. The 3 columns that the datasource is retrieving are Brand, Email_To, and Email_cc. I dont need to display them but I do need to get access
to both values so that I can feed them to the exchange server, when the email is compiled. Its not that the emails are top-secret or anything this is mostly for the purpose of being nice and clean just hiding behind the sceens no need for an extra long column
of the emails to be displayed just so I can get the value.
On the flip side is there a way to get the two values out of the datasource being filtered by the dropdownlist and assign them to sperate variables.