不知道了
不过我在VS2003里如果在if(!IsPostBack)之后帮定也会是空值,在之前就正常了
取到的值也是正常的
建议你跟踪一下看看哪里出的问题
不过我在VS2003里如果在if(!IsPostBack)之后帮定也会是空值,在之前就正常了
取到的值也是正常的
建议你跟踪一下看看哪里出的问题
解决方案 »
- 有关用户登陆的问题
- 有关Convert.ToSingle()的一个问题
- 响应回车事件?
- RoleProvider.IsUserInRoles()方法得问题
- Web Server控件与HTML Server控件的区别何在?
- DataKey key = GridView1.DataKeys[index]; 索引超出范围。必须为非负
- 二次开发一个网站 读取配置中的字符串 |DataDirectory|\XXX.mdb 求解如何读取
- 如何确定他是否按时刷卡?
- 求助高手!!!
- 怎么将动软生成的三层架构 如图 转移到web应用程序中的App_Code文件夹中呢 如图
- 如何获得当前域 不是域名是域哦
- 有个小问题
foreach是只读的,循环内不能进行赋值等操作,改成FOR试试
{
if(!IsPostBack)
{
ddl.Items.Insert(0, new ListItem("商品大类"));
}
bindlist();
}
public void bindlist()
{if (DropDownList1.Items.Count < 1)
{
int i=DropDownList1.selectindex;
csml_DB myml = new csml_DB("");
// foreach (DataRow name in myml.csml_List().Tables[0].Rows)// DropDownList1.Items.Add(name[2].ToString());
DropDownList1.DataSource = (myml.csml_List());
DropDownList1.DataTextField= "type_name";
DropDownList1.DataValueField = "type_name";
DropDownList1.selectindex=i;
DropDownList1.DataBind();
}
}
分步用索引index来解决
document.getElementById("WebCombo1_input").value = rd.parentNode.parentNode.cells[1].innerText;但是感觉页面上好像值是对的,控件认的值仍然是以前的那个值
我以前有时候取不到DropDownList的值,换成上面的写法就能取到了。
string s = Request.Form[this.DropDownList1.ClientID];
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
SqlConnection conn = new SqlConnection();
conn.ConnectionString = Session["Conn"].ToString(); DataSet ds = new DataSet(); string strCom = "select distinct Log09003 from Log09 ";
SqlDataAdapter ada1 = new SqlDataAdapter(strCom, conn);
ada1.Fill(ds, "JL01"); WebCombo1.DataSource = ds.Tables["JL01"];
WebCombo1.DataTextField = "Log09003";
WebCombo1.DataValueField = "Log09003";
WebCombo1.DataBind();
}
}上手WebCombo1的disDisplayValue里面是空值然后用JS赋值
document.getElementById("WebCombo1_input").value = rd.parentNode.parentNode.cells[1].innerText;然后按button做操作的时候,却仍然是空值protected void IMB_DEL_Click(object sender, ImageClickEventArgs e)
{
SqlConnection conn = new SqlConnection();
conn.ConnectionString = Session["Conn"].ToString(); int SubjectNum = int.Parse(this.Session["SubjectNum"].ToString()); int Log09001 = SubjectNum;
string Log09002 = Session["UserId"].ToString();
string Log09003 = WebCombo1.DisplayValue.ToString();
string Log09004 = TextBox1.Text.ToString(); string strCom = "delete from Log09 where Log09001 = " + SubjectNum + " and Log09002 = '" + Log09002 + "' and Log09003='" + Log09003 + "' and Log09004 = '" + Log09004 + "'";
SqlCommand Log09_Del = new SqlCommand(strCom, conn);
conn.Open();
Log09_Del.ExecuteNonQuery();
conn.Close();
}用了Request.Form[this.WebCombo1.ClientID].ToString();也是这个情况,不知道是什么原因头发要白咯
string Log09003 = WebCombo1.DisplayValue.ToString();
-------------------------------------------------------
DropDownList 还有 DisplayValue 这个属性呢?? 我怎么点不出来???