方法一: 驗證控件驗證(經實踐可行)
setting the maxength of a textbox when it is in multiline, you can use regularexpressionvalidator control as shown below
<asp:textbox id="txtconclusion" maxlength="200" textmode="multiline" height="100px" width="400px" runat="server" />
<asp:regularexpressionvalidator
id="txtconclusionvalidator1" controltovalidate="txtconclusion"text="超過200字" validationexpression="^[\s\s]{0,200}$"
runat="server" />
方法二:彈出對話框提示
1.html代碼
textbox的textmode取為multiline多行時,其maxlength不起作用 <html>
textbox的textmode取為multiline多行時,其maxlength不起作用 <head>
textbox的textmode取為multiline多行時,其maxlength不起作用 <title>webform6</title>
textbox的textmode取為multiline多行時,其maxlength不起作用 <meta name="generator" content="microsoft visual studio .net 7.1">
textbox的textmode取為multiline多行時,其maxlength不起作用 <meta name="code_language" content="c#">
textbox的textmode取為multiline多行時,其maxlength不起作用 <meta name="vs_defaultclientscript" content="javascript">
textbox的textmode取為multiline多行時,其maxlength不起作用 <meta name="vs_targetschema" content="http://schemas.microsoft.com/intellisense/ie5">
textbox的textmode取為multiline多行時,其maxlength不起作用
textbox的textmode取為multiline多行時,其maxlength不起作用 <script language="javascript">
textbox的textmode取為multiline多行時,其maxlength不起作用
textbox的textmode取為multiline多行時,其maxlength不起作用 function isover(stext,len)
textbox的textmode取為multiline多行時,其maxlength不起作用
textbox的textmode取為multiline多行時,其maxlength不起作用
textbox的textmode取為multiline多行時,其maxlength不起作用 {
textbox的textmode取為multiline多行時,其maxlength不起作用 var intlen=stext.value.length;
textbox的textmode取為multiline多行時,其maxlength不起作用 if (intlen>len)
textbox的textmode取為multiline多行時,其maxlength不起作用
textbox的textmode取為multiline多行時,其maxlength不起作用
textbox的textmode取為multiline多行時,其maxlength不起作用
textbox的textmode取為multiline多行時,其maxlength不起作用 alert("the content length must less than or equal "+len);
textbox的textmode取為multiline多行時,其maxlength不起作用 stext.focus();
textbox的textmode取為multiline多行時,其maxlength不起作用 stext.select();
textbox的textmode取為multiline多行時,其maxlength不起作用 }
textbox的textmode取為multiline多行時,其maxlength不起作用 }
textbox的textmode取為multiline多行時,其maxlength不起作用 </script>
textbox的textmode取為multiline多行時,其maxlength不起作用 </head>
textbox的textmode取為multiline多行時,其maxlength不起作用 <body ms_positioning="gridlayout">
textbox的textmode取為multiline多行時,其maxlength不起作用 <form id="form1" method="post" runat="server">
textbox的textmode取為multiline多行時,其maxlength不起作用 <asp:textbox id="txtname" style="z-index: 102; left: 200px; position: absolute; top: 104px" runat="server"
textbox的textmode取為multiline多行時,其maxlength不起作用 textmode="multiline" height="112px" width="271px"></asp:textbox>
textbox的textmode取為multiline多行時,其maxlength不起作用 </form>
textbox的textmode取為multiline多行時,其maxlength不起作用 </body>
textbox的textmode取為multiline多行時,其maxlength不起作用 </html>
2.cs代碼
textbox的textmode取為multiline多行時,其maxlength不起作用 private void page_load(object sender, system.eventargs e)
textbox的textmode取為multiline多行時,其maxlength不起作用
textbox的textmode取為multiline多行時,其maxlength不起作用
textbox的textmode取為multiline多行時,其maxlength不起作用
textbox的textmode取為multiline多行時,其maxlength不起作用 this.txtname.attributes.add("onblur","isover(this,1000);");
textbox的textmode取為multiline多行時,其maxlength不起作用 }
方法三: 自定義控件
multiline textbox with maxlength validation
http://www.codeproject.com/kb/aspnet/textarea_length_validator.aspx