Posted by : Anwar Hossain
Category : How to use ajax toolkit in asp.net C#

How to use ajax toolkit FilteredTextBox Control in c#

Dear viewers hear I will show how to use AJAX Filtered Text box Control Extender. Sometimes we need to take to prevent user to input invalid data in text box for data restriction purpose in this case we can use easily AJAX Filtered Textbox Control Extender. To complete this task , there is no need to learn jQuery and JavaScript but needs to implement using AJAX Filtered Textbox Control Extender . I have shown multiple example to filter text .

AJAX Filtered Text box Control Extender

HTML

Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
  <title></title>
  <style type="text/css">
  .style1
  {
  width: 100%;
  }
  .style2
  {
  color: #0066FF;
  font-weight: bold;
  }
  </style>
</head>
<body>
  <form id="form1" runat="server">
  <div>
  <table class="style1">
  <tr>
  <td width="300" align="right">
  <span class="style2">Allow Only Number Value</span>
  </td>
  <td width="5">
  &nbsp;
  </td>
  <td>
  <asp:TextBox ID="txtNumber" runat="server" Width="150px"></asp:TextBox>
  <asp:FilteredTextBoxExtender ID="txtNumber_FilteredTextBoxExtender" runat="server"
  Enabled="True" FilterType="Numbers" TargetControlID="txtNumber">
  </asp:FilteredTextBoxExtender>
  </td>
  </tr>
  <tr>
  <td width="300" align="right">
  <span class="style2">Allow Both Uppercase and Lowercase</span>
  </td>
  <td width="5">
  &nbsp;
  </td>
  <td>
  <asp:TextBox ID="txtCharcter" runat="server" Width="150px"></asp:TextBox>
  <asp:FilteredTextBoxExtender ID="txtCharcter_FilteredTextBoxExtender" runat="server"
  Enabled="True" FilterType="LowercaseLetters, UppercaseLetters" TargetControlID="txtCharcter">
  </asp:FilteredTextBoxExtender>
  </td>
  </tr>
  <tr>
  <td width="300" align="right">
  <span class="style2">Allow Uppercase</span>
  </td>
  <td width="5">
  &nbsp;
  </td>
  <td>
  <asp:TextBox ID="txtUpperCase" runat="server" Width="150px"></asp:TextBox>
  <asp:FilteredTextBoxExtender ID="txtUpperCase_FilteredTextBoxExtender" runat="server"
  Enabled="True" FilterType="UppercaseLetters" TargetControlID="txtUpperCase">
  </asp:FilteredTextBoxExtender>
  </td>
  </tr>
  <tr>
  <td width="300" align="right">
  <span class="style2">Allow Lowercase</span>
  </td>
  <td width="5">
   &nbsp;
  </td>
  <td>
  <asp:TextBox ID="txtLowercase" runat="server" Width="150px"></asp:TextBox>
  <asp:FilteredTextBoxExtender ID="txtLowercase_FilteredTextBoxExtender" runat="server"
  Enabled="True" FilterType="LowercaseLetters" TargetControlID="txtLowercase">
  </asp:FilteredTextBoxExtender>
  </td>
  </tr>
  <tr>
  <td width="300" align="right">
  <span class="style2">Allow Uppercase ,Lowercase, Number Only </span>
  </td>
  <td width="5">
  &nbsp;
  </td>
  <td>
  <asp:TextBox ID="txtUpperLowerNumberonly" runat="server" Width="150px"></asp:TextBox>
  <asp:FilteredTextBoxExtender ID="txtUpperLowerNumberonly_FilteredTextBoxExtender"
  runat="server" Enabled="True" FilterType="Numbers,UppercaseLetters,LowercaseLetters"
  TargetControlID="txtUpperLowerNumberonly">
  </asp:FilteredTextBoxExtender>
  </td>
  </tr>
  <tr>
  <td width="300" align="right">
  <span class="style2">Decemil Number Only </span>
  </td>
  <td width="5">
  &nbsp;
  </td>
  <td>
  <asp:TextBox ID="txtDecemilNumber" runat="server" Width="150px"></asp:TextBox>
  <asp:FilteredTextBoxExtender ID="txtDecemilNumber_FilteredTextBoxExtender" runat="server"
  Enabled="True" ValidChars="." FilterType="Custom, Numbers" TargetControlID="txtDecemilNumber">
  </asp:FilteredTextBoxExtender>
  </td>
  </tr>
  <tr>
  <td width="300" align="right">
  <span class="style2">Money type data filtering </span>
  </td>
  <td width="5">
  &nbsp;
  </td>
  <td>
  <asp:TextBox ID="txtMoney" runat="server" Width="150px"></asp:TextBox>
  <asp:FilteredTextBoxExtender ID="txtMoney_FilteredTextBoxExtender" runat="server"
  Enabled="True" FilterMode="ValidChars" TargetControlID="txtMoney" FilterType="Numbers, Custom"
  ValidChars=".,">
   </asp:FilteredTextBoxExtender>
  </td>
  </tr>
  </table>
  </div>
  <asp:ScriptManager ID="ScriptManager1" runat="server">
  </asp:ScriptManager>
  </form>
</body>
</html>
 

Out Put

how-to-FilterTexboxExtender-in-asp.net-C-Sharp



Realted Article Headline

How to use TextBoxWatermarkExtender in asp.net using c#
How to use Ajax AutoCompleteExtender control in asp.net using c#
How to use Ajax Collapsible panel control in asp.net c#
How to use ASP.Net AJAX Control Toolkit ModalPopupExtender Control in asp.net c#
how to add an Ajax Control Toolkit Accordion to a page
How to use html editor Ajax control toolkit example in c#
How to use Ajax ConfirmButtonExtender in asp.net using c#
how to use ajax calendar extender in asp net c#
How to use ajax toolkit FilteredTextBox Control in c#

Article Category

How to create asp.net control dynamically
Learn HTML for beginner
DataList example in C Sharp
Mail sending in asp.net c#
State Management in ASP C #
Basic sql tutorial for Beginner
DataTable example in ASP.Net C#
How to use LINQ in ASP.NET C#
asp.net c # basic tutorial
How to use ajax toolkit in asp.net C#
How to use different types of validation control using asp.net c#
How to use grid view in asp.net c#
Protected by Copyscape Online Plagiarism Detection