M
Mike Labosh
I have a WebForm that has, among other things, the following:
ASP:TEXTBOX txtCorrectedName
ASP:LISTBOX lstCorrectedNames
The list box gets loaded with all the "correct" names of cities, and the
textbox is blank. The idea is that the user can pull up a record with bogus
address info, and correct the name of the city by either typing a new name
in the textbox, or choosing one from the list.
When the user clicks the list box, I have a click event that says:
private void lstCorrectedNames_SelectedIndexChanged(object sender,
System.EventArgs e) {
txtCorrectedName.Text = lstCorrectedNames.SelectedItem.Text;
}
But I think it's silly to make a round-trip to do that. So I want to do it
with client script. Client JavaScript is easy for this, but I'm not sure
how to get to it since both are server controls. I can add the client
<script...> block, but I would still have to change the HTML generated by
the server-side framework so that the controls register their client-side
events:
<select id="lstCorrectedNames" ... onclick="return thisScriptFunction();">
--
Peace & happy computing,
Mike Labosh, MCSD
"When you kill a man, you're a murderer.
Kill many, and you're a conqueror.
Kill them all and you're a god." -- Dave Mustane
ASP:TEXTBOX txtCorrectedName
ASP:LISTBOX lstCorrectedNames
The list box gets loaded with all the "correct" names of cities, and the
textbox is blank. The idea is that the user can pull up a record with bogus
address info, and correct the name of the city by either typing a new name
in the textbox, or choosing one from the list.
When the user clicks the list box, I have a click event that says:
private void lstCorrectedNames_SelectedIndexChanged(object sender,
System.EventArgs e) {
txtCorrectedName.Text = lstCorrectedNames.SelectedItem.Text;
}
But I think it's silly to make a round-trip to do that. So I want to do it
with client script. Client JavaScript is easy for this, but I'm not sure
how to get to it since both are server controls. I can add the client
<script...> block, but I would still have to change the HTML generated by
the server-side framework so that the controls register their client-side
events:
<select id="lstCorrectedNames" ... onclick="return thisScriptFunction();">
--
Peace & happy computing,
Mike Labosh, MCSD
"When you kill a man, you're a murderer.
Kill many, and you're a conqueror.
Kill them all and you're a god." -- Dave Mustane