慕白兄,关于JS的dropdrowlist的无刷新赋值给text,请帮忙指点下
VS2005,C#,
我首先在页面load的时候填充dropdownlist
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection();
conn.ConnectionString = Session[ "Conn "].ToString();
DataSet Ds = new DataSet();
//填充dropdownlist
strCom = "select Log05003,Log05004 from Log05 where Log05001 = " + SubjectNum + " ";
SqlDataAdapter ada1 = new SqlDataAdapter(strCom, conn);
ada1.Fill(Ds, "Log07 ");
CompanyId.DataSource = Ds.Tables[ "Log07 "];
CompanyId.DataTextField = "Log05003 ";
CompanyId.DataValueField = "Log05004 ";
CompanyId.DataBind();
CompanyId.Items.Insert(0, " ");//默认第一行为空
}
下拉列表显示的是Log05003
然后在点击的时候将该行的Log05004填充到Text中
我在html里面是这么写的
function Change()
{
docoment.all.CompanyName.value = docoment.all.CompanyId.value;
}
<asp:DropDownList ID= "CompanyId " runat= "server " onchange= "Change() ">
</asp:DropDownList>
其中CompanyName为lable的名字,CompanyId为dropdownlist的名字
我试不出来,选中dropdownlist的某一行,但是相关的value值并没有在lable上显示,请帮我看下,可能是什么原因呢?
谢谢!
[解决办法]
应该是document