Wednesday, July 24, 2013

Removing HTML Tags and Java Scripts Tags From String Using Regular Expresion

From today, I am trying to post again on a regular basis

Here is a one line regular expression to remove a html tag from a string.....

In the example given below I am stripping the Script tags from the given string.

      <!--[if IE]>
        if (!document.documentMode || (document.documentMode < 9))
            document.write("<script src=\"\"><\/script>");
            document.write("<script src=\"\"><\/script>");            
            document.write("<style>.job-ad-applytool {text-align: center;}</style>");


 First try to remove the Script Tags From String using Below regular expression..

<script>[\d\D]*?>[\d\D]*?</script>     --> this  expression removes script tags from string


 Dim _content As String = Regex.Replace(_pageBody.TrimStart(), "<script>[\d\D]*?>[\d\D]*?</script>", "", RegexOptions.Multiline)

later u remove all Html Tags   From string  using Below Regular Expression

<.*?>                       ---->  this expressions remove all html tags..


 Dim _content As String  = Regex.Replace(_pageBody.TrimStart(), "<.*?>", "", RegexOptions.Multiline)

it' ll Remove all script tag's and Html Tags From string ...:)

Friday, July 19, 2013

Parse HTML Documents Easily with HtmlAgilityPack Using C#

Hi  Friend's....

In this article,  going  to  explain  how to prase and fetch the  html  page content  from web site's using HTMLAgility pack......!   

please go through below link to know more details

Prase Each Worksheet From Excel Worksheet Into DataSet Using C#

In this Post I will explain how to read each Worksheet From Excel File into a DataSet using C#.

please go through below link to know more details

InputFormTextBox Validation(Rich TextBox in Sharepoint)

InputFormTextBox Validation(Rich TextBox in Sharepoint)

In this post I will tell how to validate the InputFormTextBox contol using custom JavaScript function…if u Use  RequiredFieldValdator or InputFormRequiredFieldValidator with InputFormTextbox  U ll get some validation Issues Onclick Validation Button…Instead of RequiredFieldValidation  Just do with CustomValidator .

This is an example of Client-side validation Using Cutomvalidator…

<sharepoint:InputFormTextBox ID=”txtDetailInfoRequired” CausesValidation=”true”
AllowHyperlink=”true” RichText=”true” RichTextMode=”FullHtml” runat=”server” TextMode=”MultiLine” Rows=”6″ Columns=”10″ />
<asp:CustomValidator ID=”CustomeDetails” runat=”server” ValidationGroup=”validate”  ClientValidationFunction=”ValidationForRichDetails” ControlToValidate=”txtDetailInfoRequired” SetFocusOnError=”true” ValidateEmptyText=”true” Display=”Dynamic” ErrorMessage=”*”>

Inside  Javascript tag Define this function...

<script language=”javascript” type=”text/javascript”>
function ValidationForRichReason(source, arguments) {
var text = RTE_GetRichEditTextOnly(“<%= txtReasonofrequest.ClientID %>”);
if (text != “”) {
arguments.IsValid = true;
else {
//set focus back to the rich text editor.
RTE_GiveEditorFocus(“<%= txtReasonofrequest.ClientID %>”);
arguments.IsValid = false;


<asp:Button ID=”btnSubmit” runat=”server” Text=”Submit”  CssClass=”nav_new” ValidationGroup=”validate” />

if any doubts please comments here...good luck