synchronization

G

Guest

i have a dropdownlist (ddlConsultantCategory) and a textbox (txtRate) that
needs to be synchronized. the dropdownlist shows the "Consultant Category"
and the "Rate" (behaves as if it has 2 columns). when the user makes a
selection in the dropdownlist, txtRate should be populated with the value of
"Rate" which is the same as the 2nd column of the selected item in the
dropdownlist. this seems redundant but unfortunately that's the software
requirement. thanks in advance.

code:
string sCCI = "SELECT activity_no, des1, bill_rate "
+ "FROM pa_activity "
+ "WHERE (activity_no LIKE Upper('D0%') or activity_no LIKE
Upper('S0%')) And last_status <> 'D' "
+ " And activity_type = 'L' "
+ "ORDER BY des1 ";

OracleDataReader oraReader;
OracleConnection oraConn = new OracleConnection(connStr);
OracleCommand oraCMD = new OracleCommand(sCCI, oraConn);
oraConn.Open();
oraReader = oraCMD.ExecuteReader(CommandBehavior.CloseConnection);
while(oraReader.Read())
{
ListItem listItem = new ListItem();
listItem.Text = oraReader.GetString(1).ToString() + " - " +
oraReader.GetInt32(2).ToString();
listItem.Value = oraReader.GetString(1);
ddlConsultantCategory.Items.Add(listItem);
}
oraReader.Close();
oraConn.Close();
 
D

Dmytro Lapshyn [MVP]

Hey Newbie,

Watch for the ListView's SeelctedIndexChanged events, and once the selected
index changes, retrieve the value of the second column (the corresponding
sub-item's text, to be exact) and update the txtRate's Text property with
the retrieved value.
 
G

Guest

this has to be done on the client side (perhaps javascript)

Dmytro Lapshyn said:
Hey Newbie,

Watch for the ListView's SeelctedIndexChanged events, and once the selected
index changes, retrieve the value of the second column (the corresponding
sub-item's text, to be exact) and update the txtRate's Text property with
the retrieved value.

--
Sincerely,
Dmytro Lapshyn [Visual Developer - Visual C# MVP]


Newbie said:
i have a dropdownlist (ddlConsultantCategory) and a textbox (txtRate) that
needs to be synchronized. the dropdownlist shows the "Consultant Category"
and the "Rate" (behaves as if it has 2 columns). when the user makes a
selection in the dropdownlist, txtRate should be populated with the value
of
"Rate" which is the same as the 2nd column of the selected item in the
dropdownlist. this seems redundant but unfortunately that's the software
requirement. thanks in advance.

code:
string sCCI = "SELECT activity_no, des1, bill_rate "
+ "FROM pa_activity "
+ "WHERE (activity_no LIKE Upper('D0%') or activity_no LIKE
Upper('S0%')) And last_status <> 'D' "
+ " And activity_type = 'L' "
+ "ORDER BY des1 ";

OracleDataReader oraReader;
OracleConnection oraConn = new OracleConnection(connStr);
OracleCommand oraCMD = new OracleCommand(sCCI, oraConn);
oraConn.Open();
oraReader = oraCMD.ExecuteReader(CommandBehavior.CloseConnection);
while(oraReader.Read())
{
ListItem listItem = new ListItem();
listItem.Text = oraReader.GetString(1).ToString() + " - " +
oraReader.GetInt32(2).ToString();
listItem.Value = oraReader.GetString(1);
ddlConsultantCategory.Items.Add(listItem);
}
oraReader.Close();
oraConn.Close();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

dropdownlist 3
dropdownlist question 2
dropdownlist question 2

Top