.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Replace content of XML tags on fly

Posted By:      Posted Date: October 08, 2010    Points: 0   Category :ASP.Net


I have an XML as follows: Just a sample attached. 


This XML is sent by client/user to our dept. They may or may not send data some time. They may send "n/a" in place of data if data is not available.

So I need to replace all those "n/a" in XML to string.Empty or some other value. The order of XML may change. And we are not s

View Complete Post

More Related Resource Links

SharePoint Programming: Replace content in documents of Document Library

HI, I have 100+ word documents in one of the document libraries on our SharePoint portal. Most of these documents contain HYPERLINKS which refer to a totally different SharePoint server. My task is to update all these HYPERLINKS to point to our server instead of external server. Any pointers on how to accomplish this would be highly appreciated. Thanks in advance Mahesh B

Embedded HTML using
to replace tags in ssrs 2008   

After doing various amounts of research and testing I need to post a question here. 

I am using an html editor to format html and data (for reports) and then using reporting services to render the html harnessing the report server to view, export, and print. 

As already many of you know around here you can set an ssrs table cell to “HTML – Interpret HTML tags as styles”.  Also many of you know that this functionality does not accept <table><tr><td></td></tr></table> tags.  However, the documentation says it support <div> tags. Yet when I try using div tags with the appropriate styles for creating tables this does not work either.  So if ssrs handles <div> tags could you please tell me a complete list of style attributes it handles as well?

Regular expression or logic to replace UL LI tags


Hi All,

I have HTML which can contain ordered lists like


resulting as

  • a
    • l
    • m
      • x
      • y
    • n
  • b
  • I want to achieve following replacement

    firstLevel li with bullet (for which I will find the character)

    secondLevel li with circled bullet (for which I will find the character)

    thirdLevel li with squared bullet (for which I will find the character)

     Can this be achieved with regular expressions? Please note contents can be dynamic

    Regular expression to replace


    Hi Everybody,

    I have an HTML with content some thing like

    <div style="margin-left: 40px">a <strong>b </strong><em><strong>c</strong></em></div>

    What I want to achieve is

    <div style="margin-left: 40px"> to be replaced with &#09;

    And </div> with &nbsp;<br> without touching inside contents which are dynamic

    I thought this can be achieved using regular expression Regex.Replace but not worked on regular expression.

    Can anyone help with proper approach?



    SharePoint 2010 Content deployment jobs + Tags & Comments



    I am facing some technical challenge in SharePoint 2010 while moving content from Authoring to production, here is the scenario.

    1. We enabled Socializations features like tagging, rating and commenting on production content (pages).
    2. There is a authoring and production environments for authoring and production purposes
    3. Content is being moved from Authoring to Production using SharePoint 2010 Content deployment jobs

    Now the problem:

    Content that is there on the production allows end users to comment, rate, tag. However, when I run content publishing jobs, how rated tagged information will be updated to the updated page.

    In our case, pages will be updated with slight changes or new page can be created. For new pages it is not a issue because new social collaboration information can be stored in Social database. However, what happens to modified/updated pages tags, rating and commenting information? How SharePoint 2010 conent deployment jobs handle this issue?

    Please let me know resolutions or pointers if someone faced similar problems.



    Vijay Bodi

    remove html tags from that text being extracted from html content


    Hi there

    I have been trying to extract text from the html content ,But, had resulted with some html tags within the extracted text  , what i should i do in order  to extract only plain text wothout having too much tags or stricpts , i am testing  on differents webpages,so html elements are unknow or chagnes from time to time .i am using Html Agility Pack also . here some of code

    HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();

      doc.Load(new StringReader(result));

       HtmlNode bodyNode = doc.DocumentNode.SelectSingleNode("//body");

       string results  = bodyNode.InnerText.ToString();

    regex code
             public string removehtmltags_Regex(string source)
                return Regex.Replace(source, "<.*?>", string.Empty);
       result from this code ,


    2:59:46 PM: var _GlobalNavHeaderUtf8Encoding=true;var includeHost="http://include.ebaystatic.com/";Skip to main contentBuyMy eBaySellCommunityContact usHelpBasketBasketvjo.darw

    background image and object tags rejected as unsafe content


    Can anyone explain to me why SP2010 designed rejects and removes all images and object tags with the message:

    "content in the embedded form field may be changed by the server to remove unsafe content"

    I have prototyped a page layout using simple html/css but cannot get SP to accept large parts of my design. Even background images added using SharePoint designer are rejected!!

    Andrew Wiles - www.it-workplace.com - MDX made simple

    SharePoint Tutorial - Content Types

    SharePoint content types provide users with a way to manage and organize content in a more meaningful way. It's a reusable of settings you want to apply to a particular type of document in a library or item in a list.

    Enabling Users to Maintain SharePoint Content

    When SharePoint is installed as a corporate intranet, there is a considerable amount of effort involved in maintaining the content to keep the site relevant. As we discussed in the first few parts of this series, SharePoint has many built-in features to reduce the burden on the site administrator.

    Some areas of the site usually contain less-dynamic information. Internal memos and corporate policies are common examples of this information. One option for this information is to post these documents in a document library. Documents in a library are often stored in a few different formats: Word, Acrobat (PDF), or HTML. Each of these formats has its drawbacks.

    Application Vs. Content Pages in SharePoint

    SharePoint has two types of ASPX pages. One type is the application page, also known as a _layout page. The other type of ASPX page is a content page, also known as a site page. Each of these page types is stored in a different location in SharePoint. When developers create custom ASPX pages, they must decide on the page type.

    Enabling Users to Maintain SharePoint Content

    When SharePoint is installed as a corporate intranet, there is a considerable amount of effort involved in maintaining the content to keep the site relevant. As we discussed in the first few parts of this series, SharePoint has many built-in features to reduce the burden on the site administrator.

    Content Types in MOSS 2007

    In this article I will try to describe the one of the best feature in Microsoft office Share Point 2007 called Content Types.

    Content types are simply collection of contents.Each content in a Content type can have different settings.Basically it is a reusable collection of settings which you want to apply to a particular category of contents.

    Content Query Web Part missing in SharePoint 2010

    If you don't see content query web part listed in the web parts list, this is because you have not enabled "Search Server Web Parts" feature in site collection features. Enable this feature and content query web part will show in the list of web parts.

    Unique content within master page based on conditions met


     Hi all-

    I would like to present users with unique content based on certain conditions being met as they land on the home page (default.aspx).  The condition logic will be in the VB code behind Page Load event. The content will go in a content placeholder as specificed from the master page. 

    However, the content change wouldn't be something small (ie making a panel or label visible or not) but rather it will be different HTML,  Divs and databound gridview content.  The HTML content will be stored in the database.

    Can someone point me in the right direction for best practices on how to accomplish this?


    Passing Linq Statement between master and content page


    I usually work with windows forms, and am just starting to work with ASP.Net, so appologies if this is a dumb question!

    I have a master page which has a search button on it. The results of this are built up using a Linq statement and if there are any results, I want to display the results in a contents page.

    On the masterpage, I have the following code:

    Private _res
        Public Overridable ReadOnly Property SearchRes()
                Return _res
            End Get
        End Property
     Private Sub DoSearch()
       'some code to get a linq result
        If res.Any Then
                _res = res
                Server.Transfer("SearchResults.aspx", True)
                'no results
                LabelNoRes.Visible = True
            End If
     End Sub

    On the SearchResults.aspx page I have this code.

    Dim m As pxSite = CType(Page.Master, MasterPage)
            If m.SearchRes IsNot Nothing Then
                Label1.Text = "Results found = " & m.SearchRes.Count
            End If

    m.searchRes is always nothing. 

    What am I doing wrong here?


    Content page control passes as argument to javascript function


    Here is the content page:


    <%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="JavaDynamicCopyValue.aspx.cs" Inherits="JavaDynamicCopyValue" Title="Untitled Page" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
     <script type="text/javascript" >
     function copyValue(input, output )
       ouput.value = input.value;
       return true;
     <asp:TextBox ID="txt1" runat="server" onchange="copyValue(this,document.getElementById('<%=txt2.ClientID%>'))"></asp:TextBox>
        <br />
        <br />
        <asp:TextBox ID="txt2" runat="server"></asp:TextBox>


    I got a javascript run time error says output is undefined. if I view source of the page, the txt1 markup became:

    <input name="ctl00$ContentPlaceHol

    Rendering data with HTML tags in the DD Gridview for a selected column


    I am having trouble finding out where and how to HTML Encode a cell's data on the Dynamic Data (v4.0) gridview of List.aspx.  As a simple case, suppose I have formatted cell data that is A<br/>B in the DB.    Obviously, I want A stacked on B in the cell.

    It seems gridView1.HtmlEncode = true has gone away.

    So maybe I'll try to catch it on the RowDataBound event:

    protected void GridView1_RowDataBound(Object sender, GridViewRowEventArgs e)

                if (e.Row.RowType == DataControlRowType.DataRow)
                    // Html Encode the cells


    but this event never fires?

    Has anyone figured out how to properly render HTML tags data in the List.aspx's GridView1? 

    If I figure this out, then I can add a MetaAttribute called something like [EncodeAsHtml(true)] and be on my way.  Thanks!

    ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
    Sql Server  SharePoint  Silverlight  Others  All   

    Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend