Is there a way to detect if there are 2 consecutive carriage returns in a string ontained from a textarea or multiline text box?
Here is the scenario: In a text area, user enters ABCD "Enter" EFGHI "Enter" JKLMNOP "Enter" "Enter". After the this I need to force click event of the button - not form.submit.
Here is the default.aspx page:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<%@ Register Src="~/UserControls/Search.ascx" TagName="Search" TagPrefix="ucSearch" %>
<html xmlns="w3.org/1999/xhtml">;
<head runat="server">
<title></title> </head>
<body>
<form id="form1" runat="server">
<asp:scriptmanager runat="server"></asp:scriptmanager>
<div>
<ucSearch:Search id="search1" runat="server" />
</div>
</form>
</body>
</html>
This is the Search.ascx page:
<script language="javascript">
var inputString function doit(){inputString = document.getElementById("search1$txtSearchText").value;
if (inputString.match(/(\n\n|\r\r|\r\n\r\n)$/)) {
document.getElementById("search1_btnFindAssets").click();
}
</script>
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="Search.ascx.cs" Inherits="UserControls_Search"%>
<asp:TextBox ID="txtSearchText" TextMode="MultiLine"onKeyPress="doit();" runat="server">
</asp:TextBox>
<br>
<asp:ButtonID="btnFindAssets"runat="server"Text="Find"onclick="btnFindAssets_Click">