本文介绍了为什么我不能设置文本框“文本”属性??的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 有人可以帮忙吗?我有一个文本框,我使用以下代码以编程方式添加 : txtTest =新TextBox txtTest.ID =" ; txtLeft" + cntCount.ToString Page.FindControl(" tdInput")。Controls.Add(txtTest) 这成功创建了一个名为txtLeft1的文本框。在表格中 cell" tdInput"。现在我接下来要做的就是: Dim txtLeft1 As TextBox txtLeft1 = Page.FindControl(" txtLeft1") txtLeft1.Text =" Computer" txtLeft1.BackColor = Color.AliceBlue ....我想改变文本中的值文本框为 计算机。但是,出于某种原因,它似乎并没有起作用。我知道它几乎肯定是真的,非常明显的东西但我只是 看不出它是什么。我包含了最后一行来更改后面的 颜色,只是为了检查 脚本是否找到了文本框控件,确实如此。问题是它只是不会设置 文本。 到目前为止我已经尝试过的事情,要么是不工作,要么是由于/> Visual Studio是: txtLeft1.Value =" Computer" txtLeft1.Text.Value ="电脑 txtLeft1.Text =" Computer" .ToString txtLeft1.Text =" Computer" .ToCharArray txtLeft1.Text =" Computer" txtLeft1.DataBind() 如果有人能在这里发现明显的明显,我会的非常感谢 感激不尽!Can anyone help? I have a textbox which I''m programatically adding byusing the following code:txtTest = New TextBoxtxtTest.ID = "txtLeft" + cntCount.ToStringPage.FindControl("tdInput").Controls.Add(txtTest)This successfully creates a textbox called "txtLeft1" in the tablecell "tdInput". Now the next thing I''m doing is this:Dim txtLeft1 As TextBoxtxtLeft1 = Page.FindControl("txtLeft1")txtLeft1.Text = "Computer"txtLeft1.BackColor = Color.AliceBlue....which I''m wanting to change the value of the text in the textbox to"Computer". However, for some reason it doesn''t seem to be working. Iknow it''s almost certainly something really, really obvious but I justcan''t see what it is. I included the last line to change the backcolour, just to check that the textbox control is being found by thescript, and it is indeed. The problem is that it just will not set thetext.Things I''ve tried so far that either don''t work or are spat out byVisual Studio are:txtLeft1.Value = "Computer"txtLeft1.Text.Value = "Computer"txtLeft1.Text = "Computer".ToStringtxtLeft1.Text = "Computer".ToCharArraytxtLeft1.Text = "Computer"txtLeft1.DataBind()If anyone can spot the glaringly obvious here, I''d be immenselygrateful!推荐答案 - 显示引用的文字 -- Show quoted text - 这篇关于为什么我不能设置文本框“文本”属性??的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 05-25 19:06