How to set maxlength for multiline TextBox?

前端 未结 7 739
慢半拍i
慢半拍i 2020-12-16 01:51

When using a MultiLine TextBox (which generates a TextArea) setting the MaxLength property has no effect. What is the best workaround? I\'d like to get basic, intended funct

7条回答
  •  借酒劲吻你
    2020-12-16 02:09

    Try this..

        Dim script As String = ""
    
        script = script + " "
    
    
        Dim b As New TextBox()
        b.ID = "btnSomeButton"
        b.TextMode = TextBoxMode.MultiLine
        Mypanel.Controls.Add(b)
        b.Attributes.Add("onkeyup", "return CheckLength('" & b.ClientID & "');")
    
        Page.ClientScript.RegisterStartupScript(Page.GetType(), "key", script, False)
    

提交回复
热议问题