开发者

Other ways of 'disabling' a textbox against user input

开发者 https://www.devze.com 2023-01-23 17:06 出处:网络
in a DetailsView with the mode set to Insert, I had a textbox that is populated by an event, rather than allowing the user to type into it. Problem is, if I set the TextBox to either Enabled=\"false\"

in a DetailsView with the mode set to Insert, I had a textbox that is populated by an event, rather than allowing the user to type into it. Problem is, if I set the TextBox to either Enabled="false" or ReadOnly=开发者_StackOverflow"true", it doesn't seem to populate the SqlDataSource parameter with the value of the textbox, which I need. Is there any other ways to stop users inputting data into that textbox, but not use Enabled/ReadOnly?

Thanks


You could make it readonly with JavaScript:

TextBox1.Attributes.Add("readonly", "readonly")

I'm not sure if this approach solves your problem with the SqlDataSource.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号