谁来帮我实现这个功能呀。。。
我想实现一个功能1、选中dropdownlist1~3,在textbox1内即时显示选中的值;
2、单击button增加textbox2(原来隐藏了);
3、再次选中dropdownlist1~3,同样textbox2内即时显示选中的值,并且textbox1内的内容不改变。。。。
(注:每次选中的值都要保留,进行sql查询时用的到)
--------------------编程问答-------------------- --------------------编程问答-------------------- 选中的时候动态生成TextBox并赋值,将生成的TextBox添加到窗口。 --------------------编程问答-------------------- 用dropdownlist的SelectedIndexChanged事件
这样可以吗? --------------------编程问答-------------------- 你的需求没甚理解啊,看下可以吗
<input type="button" value="增加" onclick="createTextBox();" />
<select id="curSelect" >
<option></option>
<option value='1'>1</option>
<option value='2'>2</option>
<option value='3'>3</option>
</select>
function createTextBox() {--------------------编程问答-------------------- --------------------编程问答-------------------- SelectedIndexChanged,判断是否显示textbox2,针对性赋值。 --------------------编程问答--------------------
//父容器
var inputParent = document.getElementsByTagName("body")[0];
var select = document.getElementById("curSelect");
var selectValue = select.options[select.selectedIndex].value;
if (selectValue != "") {
var input = document.createElement("input");
input.value = selectValue;
inputParent.appendChild(input);
}
}
public partial class Form1 : Form--------------------编程问答-------------------- 作业贴。 --------------------编程问答-------------------- 同意,作业贴
{
public Form1()
{
InitializeComponent();
}
List<string> data = new List<string>();
private void Form1_Load(object sender, EventArgs e)
{
List<string> a = new List<string> { "1", "2", "3" };
comboBox1.Items.AddRange(a.ToArray());
comboBox1.SelectedIndex = 0;
data.Add(comboBox1.SelectedItem.ToString());
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
data.Add(comboBox1.SelectedItem.ToString());
if (!textBox2.Visible)
{
textBox1.Text = comboBox1.SelectedItem.ToString();
}
else
{
textBox2.Text = comboBox1.SelectedItem.ToString();
}
}
private void button1_Click(object sender, EventArgs e)
{
textBox2.Visible = true;
}
}
补充:.NET技术 , C#