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.
精彩评论