如果您是.net的专家,请解决此问题 [英] Solve this Question if u r expert in .net

查看:72
本文介绍了如果您是.net的专家,请解决此问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码是-

My code is -

thisRow += "<table><tbody><tr><td align="right" nowrap=""><input id='txtAmt'  runat="server" type='text' MaxLength='18' Style='text-align: right; Width:140px'/></td></tr></tbody></table>";


这是我在.cs页中写的代码,这里是一个输入标签,但是找不到ID.


This is the code which I wrote in .cs page here one input tag is here but m not able to find the ID.

推荐答案

完全没有意义:

This code doesn''t make any sense at all:

thisRow += "<table><tbody><tr><td align=\"right\" nowrap=\"\"><input id='txtAmt'  runat=\"server\" type='text' MaxLength='18' Style='text-align: right; Width:140px'/></td></tr></tbody></table>";



input HTML标记具有属性runat="server",但是此属性仅对编译.aspx文件内部的标记的编译器部分有意义.您的HTML代码是在文件背后的代码中构造的,很可能会发送回客户端的浏览器.编译器将永远不会看到此标记,因为它不在aspx标记文件中.因此,后面的代码中将没有txtAmt对象.

接下来的事情是,您没有正确转义应该在要组装的字符串中使用双引号.

最好的问候,

—MRB



The input HTML tag has an attribute runat="server", but this attribute only makes sense to the part of the compiler which compiles the markup inside the .aspx files. Your HTML code is being constructed in the code behind file and will most probably be sent back to the client''s browser. The compiler will never see this tag since it''s not in an aspx markup file. Thus there won''t be a txtAmt object available in the code behind.

The next thing is that you haven''t properly escaped the double quotes that are supposed to be in the string you''re assembling.

Best Regards,

—MRB


这有很多错误.属性值需要双引号而不是单引号,并且服务器"需要转义.
There''s quite a lot wrong with that. Attribute values need double quotes rather than single, and the "server" needs escaping.


该字符串似乎不合适....尝试以下操作...(将所有内部关键字都包含在单引号中) quote,runat =''server'')

the string seems not propper one... try the following... (include all internal keywords in single quote, runat=''server'' too)

thisRow += "<table> <tbody> <tr> <td align="right" nowrap="nowrape"> <input id='txtAmt'  runat="server" type='text' maxlength='18' style='text-align: right; Width:140px' /> </td> </tr> </tbody> </table>";



如果解决您的问题,则标记为答案:)



mark as answer if solves your problem :)


这篇关于如果您是.net的专家,请解决此问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆