不使用 jQuery 或 Javascript,因为这是对现有站点的修复,并且不是那样设计的。Well I have gotten to a point where when the DropDownList is selected and does it's postBack I do my logic of setting the textBox readOnly status to true or false. 我现在遇到的问题是 selectValue 不一致。它在 selct 字段中显示的内容不是发布回页面的内容。假设我有 None, 5.00, 10.00, 15.00, 20.00 作为我的选择。我首先选择 10.00 并返回 None 然后我选择 20.00 它显示 10.00。它回发先前的选择值。整个网站是从页面背后的代码编写的。aspx 页面完全是从 .vb 页面写入的。一切都写入asp标签。这是代码;
If Page.IsPostBack Then
If product_option_is_required > 0 then
myTextBox.ReadOnly= true
Else
myTextBox.ReadOnly= false
End if
For Each child_control As Control In productOptions.Controls
If TypeOf child_control Is DropDownList Then
Dim child_ddl As DropDownList = child_control
tempName = products.getProductDependant("product_option_name",product_option_id)
tempSelectText = products.getProductSelectDependant("product_option_detail_name",child_ddl.SelectedValue)
priceDependant.Text ="here" & child_ddl.ID & " " & child_ddl.SelectedIndex & " " & child_ddl.SelectedValue & " --" & tempSelectText
If child_ddl.Text = "None" then
myTextBox.ReadOnly = true
myTextBox.Text = "If selected above enter name"
Else
myTextBox.ReadOnly = false
myTextBox.Text = ""
End if
End If
next
End if