隐藏字段属性错误 [英] Hidden field property error
问题描述
我有下一个按钮的代码但我遇到错误...
'HiddenField'不包含'Text'的定义,也没有扩展方法'Text'接受第一个参数可以找到类型'HiddenField'(你是否错过了使用指令或汇编引用?)
CAN有人帮我解决这个问题吗?
我尝试了什么:
protected void Button2_Click(object sender,EventArgs e){ int count = 0; if(HiddenField1.Text.Trim()!= null)count = Convert.ToInt32(HiddenField1.Text)+ 1;我++; if(count< ds.Tables [0] .Rows.Count - 1){TextBox1.Text = ds.Tables [0] .Rows [count] [Question]。ToString(); Label2.Text = ds.Tables [0] .Rows [count] [Choice1]。ToString(); Label3.Text = ds.Tables [0] .Rows [count] [Choice2]。ToString(); Label4.Text = ds.Tables [0] .Rows [count] [Choice3]。ToString(); Label5.Text = ds.Tables [0] .Rows [count] [Choice4]。ToString(); Label6.Text = ds.Tables [0] .Rows [count] [Choice5]。ToString(); HiddenField1.Text = count.ToString(); } else {Response.Write(你已经到了这个类别的记录的末尾!!); }}
I have this code of next button but i face an error...
'HiddenField' does not contain a definition for 'Text' and no extension method 'Text' accepting a first argument of type 'HiddenField' could be found (are you missing a using directive or an assembly reference?)
CAn anyone help me to solve this problem?
What I have tried:
protected void Button2_Click(object sender, EventArgs e) { int count = 0; if (HiddenField1.Text.Trim()!= null) count = Convert.ToInt32(HiddenField1.Text) + 1; i++; if (count < ds.Tables[0].Rows.Count - 1) { TextBox1.Text = ds.Tables[0].Rows[count]["Question"].ToString(); Label2.Text = ds.Tables[0].Rows[count]["Choice1"].ToString(); Label3.Text = ds.Tables[0].Rows[count]["Choice2"].ToString(); Label4.Text = ds.Tables[0].Rows[count]["Choice3"].ToString(); Label5.Text = ds.Tables[0].Rows[count]["Choice4"].ToString(); Label6.Text = ds.Tables[0].Rows[count]["Choice5"].ToString(); HiddenField1.Text = count.ToString(); } else { Response.Write("You have reached the end of records in this category!!"); }}
推荐答案
HiddenField
没有文本
属性,使用 HiddenField.Value Property [ ^ ]
HiddenField
doesnt haveText
Property, use HiddenField.Value Property [^]
这篇关于隐藏字段属性错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!