asp:textbox readonly

前端 未结 4 1511
一整个雨季
一整个雨季 2021-02-08 01:16

In asp file I have two asp:textbox




        
相关标签:
4条回答
  • 2021-02-08 01:23

    "bbb" is being posted back, but .NET will not populate a read-only textbox from postback data. You can manually populate the text box by grabbing the form data yourself from the Page_Load() method as follows:

    textValue2.Text = Request.Form[textValue2.UniqueID];

    0 讨论(0)
  • 2021-02-08 01:28

    Remove the server side attribute - ReadOnly - from the TextBox and set the HTML attribute from the code. You will be able to access the value then in post back:

    textValue2.Attributes.Add("readonly","readonly");
    
    0 讨论(0)
  • 2021-02-08 01:32

    I think instead of readonly, set your value to the textbox and then disable it.

    0 讨论(0)
  • 2021-02-08 01:43
    <asp:TextBox ID="textValue2" runat="server" Width="100px" ReadOnly="true"/>
    

    You are missing a quotation mark before 'true', it might cause issues.

    0 讨论(0)
提交回复
热议问题