HTML输入类型按钮:无效属性
in an old ASP.NET Web Forms application I got this warning in the aspx code of a page:
Attribute 'fullname' is not a valid attribute for element 'input'
Why was written in this way?
And there is a way to resolve it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您只会收到警告。一个简单的问题是,开发人员刚刚构成了一个属性,并以某种价值推翻。这是合法的,我经常这样做是为了说一个标准的文本框。
因此,例如,我可以将5或10个文本框和控件放置在DIV内,这样的说明:
请注意,我想定义哪个数据库列以“填写”上述控件。
因此,我有一个带有数据行的例程。
以上例程查找具有“ F = DataColum”的任何控件,并为我填写控件。
所以,我明白了:
换句话说,我的自定义“ F”属性使我可以从数据库中获取数据并填写网页 - 而无需每次编写新代码。 (而且我有一个反常的例程 - 将所有控件写入f =“一些数据列”回到数据库中。使用这个简单的概念,然后我可以将任何网页读取/从数据库中读取/写入数据 - 和不必一遍又一遍地编写相同的代码,我得到了一个整个CRUD系统,并且通过添加一个“构成”属性的简单概念来实现,该属性定义了要使用的数据库
。 按钮添加一些自定义值。
即使在网格视图中为一个
您可以在vs中被抑制,但是我经常提到的措施, 构成一些属性,在大多数情况下,该按钮是合法
。
的 一般规则忽略了警告。那些自定义或“构成”属性。在大多数情况下,您会收到警告,但其他情况下,这并不是什么大不了的问题。当然,您确实必须很贴心,因为在大多数情况下,这种自定义属性没有自动视图状态,并且它们的价值无法正确地持续到往返(后背包和页面返回)。但是,对于上述示例之类的表达式或值,它不是问题。
You only get a warning. The simple issue is that the developer just made up a attribute, and shoved in some value. this is legal, and I often do this for say a standard text box.
so, I might for example place 5 or 10 text boxes and controls inside of a div, say like this:
Note in above, I wanted to define what data base column for a routine to "fill out" the above controls.
So, I have a routine I call with a data row.
the above routine looks for any control with a "f=datacolum", and fills out the controls for me.
So, I get this:
In other words, my custom "f" attribute allows me to pull data from a database, and fill out the web page - and without having to write new code each time. (and I have a reverse routine - writes out all controls with f="some data column" back to the database. With this simple concept, then I am able to have any web page read/write data to/from the database - and not have to write that same code over and over. In effect, I get a whole crud system, and all achieved by a simple concept of adding a "made up" attribute "f" that defines the data base column to use.
So, you can in VS have that warning suppressed, but I as noted OFTEN make and add some custom values. Even for a button in a grid view, you might have this:
And then in code behind, you have this:
So, we often just make up some attribute, and it is legal to do so in most cases.
So, that button - say dropped into a grid view now can pass values to the button click - even values not displayed in the gridview.
So, you can just as a general rule ignore the warning. It is not super common, but a lot of developers often will add and make up their own attributes, and client side code (JavaScript) or even code behind as above shows is then free to use the values in those custom, or "made up" attributes. In most cases, you get a warning, but other then that, it not a huge deal nor issue. You of course do have to be carful, since such custom attributes in most cases don't have automatic view state, and their values will not persist correctly for a round trip (post-back, and page return). However, for expressions or values such as above example, then its not a problem.