Hide HTML Tags in DataView Web Part

Hi,
I've just added a Data View web part to a Sharepoint 2010 page. However, the data entries show up with inline HTML tags. How can I fix this, to get the web part to display column data without the HTML tags? Pls advise.

Hope you have used the attribute "disable-output-escaping" and set it to true.
<xsl:value-of select="$field" disable-output-escaping="yes"/>
Thanks Sandy

Similar Messages

  • Status of DataView Web Part in SharePoint 2013

    I hope this is a simple question but I'm stumped. What is the status of the DataView Web Part in SharePoint 2013? I am working on a migration of our site from SP 2010 to SP 2013. We previously had a DataView Web Part which is used widely on our site. It
    is not showing up and the error is "Type type could not be found or it is not registered as safe." When I try to add a new copy of this web part, I get the message "The type Microsoft.SharePoint.WebPartPages.DataViewWebPart....PublicKeyToen=71e9bce111e9429c"
    could not be found or it is not registered as safe.
    I'm not the Farm Admin is this case, so my question is whether the web.config needs to be edited to make this usable, or something else perhaps. Or am I simply out of luck using this in SharePoint 2013.
    Any help is appreciated!

    I suspect you will need to compare the web.config files on the new 2013 system to the ones on the old 2010 system and evaluate the differences.  The safecontrol entry is in my default 2013 environment.  If its not in yours it will need to be added.
     For any web part to work you need three things:
    A safe control entry in the web.config
    A .dll that contains the code that generates the html displayed when the web part is rendered.
    A .dwp or .webpart file in the web part gallery that contains info about what class and .dll to use
    #3 should be in the content database you are migrating.  YOu'll need to verify that #1 & #2 exist.
    Paul Stork SharePoint Server MVP
    Principal Architect: Blue Chip Consulting Group
    Blog: http://dontpapanic.com/blog
    Twitter: Follow @pstork
    Please remember to mark your question as "answered" if this solves your problem.

  • Errors while editing the xsl for dataview web part

    while modifying a dataview webpart in sharepoint designer, i finding the issues for the below line
    <xsl:for-each select="$Rows[substring-before(substring-after(substring-after(@FullName, '?ID='), '>'), '<') = $FullName]">
    errors:
    the tag is marked invalid because it is missing quote for  '>' and '<'
    the tag is marked invalid because it has an extra quote ">

    Hi ,
    According to your description, my understanding is that you got an error when you edited the xsl for dataview web part.
    Please try to change
    <xsl:for-each select="$Rows[substring-before(substring-after(substring-after(@FullName, '?ID='), '>'), '<') = $FullName]">
    To
    <xsl:for-each select="$Rows[substring-before(substring-after(substring-after(@FullName, '?ID='), '&gt;'), '&lt;') = $FullName]">
    Best Regards,
    Wendy
    Wendy Li
    TechNet Community Support

  • Exporting to Microsoft Excel from a DataView Web Part consuming a Web Service with Parameters

    In Sharepoint Designer, I've developed a page displaying a DataView Web Part which consumes an XML Web Service with three parameters.  These parameters are passed in from a simple Form Web Part containing three input fields.  I am able to provide default values for the web service so the dataview is initially populated, and when I enter in new parameters, the web service goes back, grabs the requested data and displays in the dataview nice and slick.
    The problem I'm having is this: In Internet Explorer 7, when I right-click on the DataView Web Part and select Export to Microsoft Excel, Excel opens up, says "ExternalData_1: Getting Data..." and returns the data from the web service which applies to the default parameter values each and every time, regardless of whether I have changed the parameters on the web page, and contrary to what the DataView Web Part displays on the screen.
    Has anyone else run into this, and is there a solution to the problem?
    Best regards,
    Mark Christie

    Hi Bullish35,
     It's possible to provide single export button and export your 4 dataview webparts. Here's the modified code.
    <Script Language="Javascript">
    function isIE() // Function to Determine IE or Not
    return /msie/i.test(navigator.userAgent) && !/opera/i.test(navigator.userAgent);
    function exportToExcel() // Function to Export the Table Data to Excel.
    var isIEBrowser = isIE();
    if(isIEBrowser== false)
    alert('Please use Internet Explorer for Excel Export Functionality.');
    return false;
    else
    var strTableID1 = "detailsTable1", strTableID2 = "detailsTable2", strTableID3 = "detailsTable3", strTableID4 = "detailsTable4";
    var objExcel = new ActiveXObject("Excel.Application");
    var objWorkBook = objExcel.Workbooks.Add;
    var objWorkSheet = objWorkBook.Worksheets(1);
    var detailsTable = document.getElementById(strTableID1);
    var intRowIndexGlobal= 0;
    for (var intRowIndex=0;intRowIndex<detailsTable1.rows.length;intRowIndex++)
    for (var intColumnIndex=0;intColumnIndex<detailsTable1.rows(intRowIndex).cells.length;intColumnIndex++)
    if(intColumnIndex != 3)
    objWorkSheet.Cells(intRowIndexGlobal+1,intColumnIndex+1) = detailsTable1.rows(intRowIndex).cells(intColumnIndex).innerText;
    intRowIndexGlobal++;
    for (var intRowIndex=0;intRowIndex<detailsTable2.rows.length;intRowIndex++)
    for (var intColumnIndex=0;intColumnIndex<detailsTable2.rows(intRowIndex).cells.length;intColumnIndex++)
    if(intColumnIndex != 3)
    objWorkSheet.Cells(intRowIndexGlobal+1,intColumnIndex+1) = detailsTable2.rows(intRowIndex).cells(intColumnIndex).innerText;
    intRowIndexGlobal++;
    for (var intRowIndex=0;intRowIndex<detailsTable3.rows.length;intRowIndex++)
    for (var intColumnIndex=0;intColumnIndex<detailsTable3.rows(intRowIndex).cells.length;intColumnIndex++)
    if(intColumnIndex != 3)
    objWorkSheet.Cells(intRowIndexGlobal+1,intColumnIndex+1) = detailsTable3.rows(intRowIndex).cells(intColumnIndex).innerText;
    intRowIndexGlobal++;
    for (var intRowIndex=0;intRowIndex<detailsTable4.rows.length;intRowIndex++)
    for (var intColumnIndex=0;intColumnIndex<detailsTable4.rows(intRowIndex).cells.length;intColumnIndex++)
    if(intColumnIndex != 3)
    objWorkSheet.Cells(intRowIndexGlobal+1,intColumnIndex+1) = detailsTable4.rows(intRowIndex).cells(intColumnIndex).innerText;
    intRowIndexGlobal++;
    objExcel.Visible = true;
    objExcel.UserControl = true;
    </Script>
    I haven't tested this. But it should work! :)Regards,
    Venkatesh R
    /* My Code Runs in Visual Studio 2010 */
    http://geekswithblogs.net/venkatx5/

  • Hiding the outline section of PPT converted to HTML in Page Viewer web part

    Hello,
    I've converted the PPT (Office 2010) to HTML using .SaveAs command. I'm adding this HTML on my SharePoint site in a page viewer web part. I get an outline section for PPT which shows all the slides. By default, I want the outline section to be closed (collapsed)
    so that I see PPT slide in full view.
    Has anyone done this before?
    Thanks,
    Ajit

    Hi Ajit,
    When we save PPT as HTML page, the PPT HTML page uses a lots of html pages and JavaScript functions to show the slides in a web browser. When we click "Outline" button, we can be able to show or hide the outline. Actually, this button uses JavaScript to
    do so.
    In this case, in order to show full page on load, we can simulate the action that clicking the "Outline" button onload.
    Open the PPT HTML folder(if we save PPT to HTML, there will have a folder)
    Open the file outline.htm with text editor
    Modify the Load function to be:
    function Load() {
        if (IsWin("PPTOtl")) {
            LoadOtl();
            parent.gOtlLoaded = true;
            var btn = new TxtBtn(
            "nb_otl", "nb_otlElem", parent.ToggleOtlPane, GetOtlState);
            if (btn != null) {
                btn.SetPressed();
                btn.Perform();
            return
        if (g_supportsPPTHTML) {
            if (IsWin("PPTNav")) {
                LoadNav("NavObj", UpdNav);
                parent.gNavLoaded = true;
                return
            if (IsWin("PPTOtlNav")) {
                LoadNav("OtlNavObj", UpdOtlNav);
                parent.gOtlNavLoaded = true;
                return
    Once we done, and upload the files to SharePoint again, the page viewer web part will show the PPT in full page.
    If there is anything unclear, please feel free to ask.
    Thanks,
    Jinchun Chen
    Jinchun Chen
    Forum Support
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff AT microsoft.com(Please replace AT with @)

  • How to hide html tags in RSS reader

    Hello everyone!
    I need a help. I`m not a programmer, but I make a very simple RSS reader based on this tutorial http://mobile.dzone.com/articles/building-mobile-rss-reader ... Application works perfect, but I have a problem into DetailsView (rss feed item)... In this view application show me a all html tags into rss feed (or articles on my website)... Content into Description (in application) begins with <p> margin-left: 4px,.... and other html tags. Please, tell me how I set to hide this tags and show only a article content (text)..I
    I will be really greatful for any help!
    Best regards,
    Rok

    Unfortunately no, there is not. It's absolutely needed so that site studio knows how to load the pages. One thing you can do is to use SSPU (site studio publishing utility) to generate static pages and then use a scripting language, such as perl, to strip out all the site studio-specific code from those pages.
    Sorry, but that's one big downside to using site studio.

  • Extra pair of HTML /HTML tag included at web source

    I have created a report of JSP format. The charset of the file was UTF-8 and the report contained some Chinese words. When I previewed the file using Reports Developer, it displayed the Chinese words correctly. Then I deployed the report to Oracle AS server. However, when I browsed the report from web browser using "rwservlet?report=abc.jsp&userid=system/manager@ccc&destype=cache&desformat=html" command, it could not display the Chinese words correctly because the charset encoding is set to ISO-8859 (English).
    I have already set the report to use charset UTF-8. Then I opened the file in the "cache" directory at web browser. It displayed the Chinese words correctly and the default encoding was UTF-8. The next step was viewing the source code of the content displayed using "rwservlet" command. I finally found that there was an extra pair of <HTML></HTML> tag at the beginning of source code. The source code therefore looks like:
    <HTML>
    <Head>
    <base href="http://dev.abc.com:7777/reports/rwservlet/getfile/rep_dev/1/06587041.htm">
    </Head>
    </HTML>
    <HTML>
    <Head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    </Head>
    <Body>
    </Body>
    </HTML>
    There are two pairs of <HTML></HTML> tag!
    The content of the pair of tag include a reference to the corresponding file at the "cache" directory, but it did not specific any charset encoding. When I manually changed the encoding from ISO-8859 to UTF-8, the Chinese words were displayed correctly.
    Can someone tell me why there is an extra pair of <HTML></HTML> tag at the beginning of source code? Where can I set the charset encoding of the extra pair of tag?
    Actually I face the same problem when sending the output to printer by setting the "destype" to printer. The Chinese words are not printed correctly.
    Thank you very much for any help and idea.
    - Man Ip

    Sorry that there is some problem on the displayed source code.
    The 3rd line should be as follow:
    base href="http://dev.abc.com:7777/reports/rwservlet/getfile/rep_dev/1/06587041.htm"
    - Man Ip

  • Hide Chrome by default Client Web Part App

    Can someone please point out if there is a way to turn off the Chrome by default in a Client Web Part App?
    I would like the ChromeType to be set to "None" unless otherwise specified in the Web Part settings. 
    Keith Tuomi | Twitter: @itgroove_keith | Blog:
    http://yalla.itgroove.net
    Please click "Propose As Answer" if a post solves your problem or "Vote As Helpful" if a post has been useful to you.

    Can you please try using
    <Elements xmlns="http://schemas.microsoft.com/sharepoint/">
    <ClientWebPart Name="ClientWebPart" Title="SharePointApp1" Description="SharePointApp1 description" DefaultWidth="300" DefaultHeight="200">
    <Content Type="html" Src="~appWebUrl/Pages/ClientWebPart.aspx?{StandardTokens}" />
    <Properties>
    <Property Name="ChromeType" WebCategory="Appearance" RequiresDesignerPermission="true" WebBrowsable="true" Type="enum" DefaultValue="None" PersonalizationScope="user" PersonalizableIsSensitive="false"></Property>
    </Properties>
    </ClientWebPart>
    </Elements>
    jaik

  • Hide footer in List View web part

    I've created a custom content type for a custom list (News stories.) I can add the custom list to my page as a list view web part and display only the latest article, but it also displays "1-1" at the bottom of the web part. I'm able to cycle through
    the news stories by hitting "1-1" (changes to "2-2", etc...), but I'd like to have the option of taking it out completely.

    Found how to remove header as well.
    <br><style><br
    />  tr.ms-viewheadertr {<br />  display:
    none<br
    />  }<br /></style><br>

  • WAD Using Frameset html tag in a web template

    I try to create a web template with 3 frames (Header, Navigation and body) with <frameset> tag and when i try to upload the html file to the server I get the error:
    Run time error:
    Invalid Colunm name or number

    Here is a sample of our BW HomePage HTML which is a frameset with 4 frames: Banner, Role Menu(report tree), Body (text), Links.
    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    <meta name="GENERATOR" content="Microsoft FrontPage 5.0">
    <meta name="ProgId" content="FrontPage.Editor.Document">
    <title>New Page 2</title>
    <link rel="stylesheet" href="Mime/BEx/StyleSheets/BWReports.css" type="text/css">
    </head>
    <frameset rows="53,*" framespacing="4" border="0" frameborder="0">
      <frame name="banner" scrolling="no" noresize target="contents" src="http://p40-ci.eh.pweh.com:3850/sap/bw/BEx?sap-language=EN&cmd=ldoc&TEMPLATE_ID=ZP_BW_ROLE_MENU_BANNER" marginheight="0" marginwidth="0">
      <frameset cols="31%,*,25%">
        <frame name="contents" target="main" src="http://p40-ci.eh.pweh.com:3850/sap/bw/BEx?sap-language=EN&cmd=ldoc&TEMPLATE_ID=ZP_BW_ROLE_MENU_CONTENTS" scrolling="auto" style="border: 3px solid #C0C0C0">
        <frame name="main" src="http://p40-ci.eh.pweh.com:3850/sap/bw/BEx?sap-language=EN&cmd=ldoc&TEMPLATE_ID=ZP_BW_ROLE_MENU_BODY" scrolling="auto" style="border-right: 3px solid #C0C0C0; border-top: 3px solid #C0C0C0; border-bottom: 3px solid #C0C0C0">
        <frame name="links" src="http://p40-ci.eh.pweh.com:3850/sap/bw/BEx?sap-language=EN&bsplanguage=EN&CMD=LDOC&TEMPLATE_ID=ZP_BW_ROLE_MENU_LINKS" scrolling="auto" noresize style="border-right: 3px solid #C0C0C0; border-top: 3px solid #C0C0C0; border-bottom: 3px solid #C0C0C0" marginwidth="5" marginheight="15">
      </frameset>
      <noframes>
      <body>
      <p>This page uses frames, but your browser doesn't support them.</p>
      </body>
      </noframes>
    </frameset>
    </html>
    ***NOTE:  You cannot edit this HTML in WAD in Layout Mode, ONLY HTML MODE.  Another way to maintain template HTML code is via Report RS_TEMPLATE_MAINTAIN.
    Hope that helps,
    Don May

  • Web Part specific DOM Manipulation. Two identical Script Editor Web Part code blocks.

    We have a script editor web part with javascript that references some jquery libraries.  The code creates web part properties and hides  DIV tag in the web part based on some conditions.  It works great until I try to place the same exact
    web part / code block on the same page twice. The way we are rolling this out we don' t users messing the code and we want the WP properties UI to be identical on both Web Parts.
    Given all this.. is it possible with jquery code to perform Web Part specific DOM manipulation without any conflict with other similar Web Parts and Script editor code blocks on the page?  Possible to dynamically change DIV Tag IDs, Jquery Variables
    and WP Properties to have the unique web part GUID?
    Possible?  Any ideas would be appreciated.
    demo of issue here:
    http://screencast-o-matic.com/watch/coeUlneNT6
    Code in question:

    Hi,
    I suggest you debug your code using IE F12 developer tools. Based on your description, you can try to add some conditions base on the web part ID.
    Or you can share your full code for further research.
    Best Regards,
    Dennis Guo
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • Search by tag not working in content search web part

    Hi,
    I am trying to configure content search web part that only pull result with a specific tags. I have created a document library and assign tags on some document, also configured Managed Meta data service and search service application. Schedule search continuous
    crawl.
    If i am not specify any tag content search web part shows results but when I restrict result with specific tag like (#HomePage) it doesn't pull any result, i have also run crawl after tagging documents in document library.
    Kindly help me out.

    Lets suppose you have your "managed metadata property" added to your list/library with name "MetadataColumn". Crawled property is created  with name ows_MetadataColumn (I guess). Then You need to create a new managed property in
    search settings and map it to your crawled property (ows_...).
    Nothing else, use your Managed property in content search webpart and filter your results.
    MVS RAVI KUMAR

  • SharePoint 2010 migration - web part gallery shows "This item is no longer available ... Click OK to refresh page

    This error IS on the WEB PART GALLERY itself.  I have dealt with it on other libraries by deleting the listview web part and adding a dataview web part. 
    However, if you try to add a dataview web part the web part gallery  the gallery is not available under lists or libraries so their is no way to add.
    I have also tried creating other views as suggested by some articles
    I have the view application pages permission as suggested by other articles.
    I believe I have read every article related and am unable to find an answer. 
    Any help on this would be appreciated. 
    As a side note, I have an option called "Manage Columns" when I go into the library settings for the Web Part Gallery.  Is this normal or is it some sort of add on. 
    Thanks for listening ==Lee
    --Lee

    Same problem, but with sharepoint 2013 after upgrade. Will post if i find a solution.
    Seems like it is getting a 401 error on some URLs from fiddler. Here is a working list on a different site, same web application. the 200s are the working list and the 401s are the non working ones.
    # Result Protocol Host URL Body Caching Content-Type Process Comments Custom
    69 401 HTTP WEBSITE.DOMAIN.COM /LIST1_BROKEN/_layouts/15/inplview.aspx?Cmd=Ctx&List={3B84632C-53EB-48EC-AF99-8616808BA2F3}&View={4A1F6B9A-F58A-4D02-9820-9145D056B4F2}&ViewCount=1&ID=8631&ListViewPageUrl=http://WEBSITE.DOMAIN.COM/LIST1_BROKEN/Lists/servicerequests/OpenSRs.aspx 0 private iexplore:4116
    # Result Protocol Host URL Body Caching Content-Type Process Comments Custom
    71 401 HTTP WEBSITE.DOMAIN.COM /LIST1_BROKEN/_layouts/15/commandui.ashx?ver=-1271193892&id=Ribbon.Read&lcid=1033&qt=ribbonvisibletabdeep 0 private iexplore:4116
    # Result Protocol Host URL Body Caching Content-Type Process Comments Custom
    66 200 HTTP WEBSITE.DOMAIN.COM /LIST2_WORKS/_layouts/15/inplview.aspx?Cmd=Ctx&List={62DF59D0-5426-49A7-8ED0-CB40DF3B7940}&View={D053E0B9-88D0-4540-B95A-DF15B8D339AD}&ViewCount=1&ID=4216&ListViewPageUrl=http://WEBSITE.DOMAIN.COM/LIST2_WORKS/Lists/servicerequests/ByAssignedTo.aspx 2,145 no-cache; Expires: -1 text/html; charset=utf-8 iexplore:3240
    # Result Protocol Host URL Body Caching Content-Type Process Comments Custom
    67 200 HTTP WEBSITE.DOMAIN.COM /LIST2_WORKS/_layouts/15/tenantappinfo.ashx?etag=0&lcid=1033 4,509 private text/html; charset=utf-8 iexplore:3240

  • Crystal Report Viewer in Sharepoint Page Viewer Web Part

    In our SharePoint setup, we have a web part that contains links that either hides or shows three other web parts (page viewer web part).  When entering the page, the first web part is shown and the other two are "hidden".  Clicking on the links will toggle through these three web parts.  Link 1 = Web Part One Visible, Web Part Two and Three Hidden.  Link 2 = Web Part Two Visible, Web Part One and Three Hidden.  Link 3 = Web Part Three Visible, Web Part One and Two Hidden.
    Our problem involves the CrystalReportViewer.  We have created a page that allows us to open the last successful instance of a report with the viewer.  This works correctly when calling the link directly from IE.  When we place this link in either the second or third web part, the report does not show.  The viewer borders will appear but the report itself will not.  If the .aspx is placed in the first part, the report appears without issue.  We do not want the .aspx to be called by the first web part and need it to load in one of the other two.  We can get the report to show in the other web parts if you right click on the empty space where the report should be and hit refresh.
    What do we need to do to get the report to load correctly in either of the two web parts?  We have looked at several options and can not get anything to work.  We didnt have this issue when using BOE XI R2 with an .asp opening the reports.  Please let me know if more info is needed.  We are running BOE XI R3.1 currently.
    Thanks

    We havent tried that.  We changed the link in the web part to access an html page that claims that the report is loading.  It states in the html that if the page doesnt load to "click here" which redirects to the crystalreportviewer.  Its a temp fix for it.  One thing we are looking at is the 64 bit version of the Sharepoint integration kit.  That may contain a reportviewer webpart.
    Thanks for the reply.
    Brian

  • Modify the data source of a data view web part

    I have a dataView web part deployed in a template in multiple site collection. This dataView hasn't any query set up, so it loads a lot of items and this is slowing down my system.
    Now I want to programmatically put a query overriding the existent (empty) one and I'm doing like this:
    System.Web.UI.WebControls.WebParts.WebPart y = (System.Web.UI.WebControls.WebParts.WebPart)item;
    Microsoft.SharePoint.WebPartPages.DataFormWebPart z = (Microsoft.SharePoint.WebPartPages.DataFormWebPart)item;
    StringBuilder dataSourceString = new StringBuilder("<%@ Register TagPrefix=\"sharepoint\" Namespace=\"Microsoft.SharePoint.WebControls\" Assembly=\"Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c\" %>");
    dataSourceString.Append("<%@ Register TagPrefix=\"WebPartPages\" Namespace=\"Microsoft.SharePoint.WebPartPages\" Assembly=\"Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c\" %>");
    dataSourceString.Append("<sharepoint:SoapDataSource runat=\"server\" SelectUrl=\"http://intranet.contoso.com/sites/spc/_vti_bin/lists.asmx\" InsertUrl=\"\" UpdateUrl=\"\" DeleteUrl=\"\" SelectAction=\"http://schemas.microsoft.com/sharepoint/soap/GetListItems\" InsertAction=\"\" UpdateAction=\"\" DeleteAction=\"\" SelectPort=\"ListsSoap\" InsertPort=\"\" UpdatePort=\"\" DeletePort=\"\" SelectServiceName=\"Lists\" InsertServiceName=\"\" UpdateServiceName=\"\" DeleteServiceName=\"\" AuthType=\"Basic\" AuthUserName=\"contoso\\administrator\" AuthPassword=\"pass@word1\" WsdlPath=\"http://intranet.contoso.com/sites/spc/_vti_bin/lists.asmx?WSDL\" XPath=\"\" ID=\"SoapDataSource3\">");
    dataSourceString.Append("<SelectCommand><soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"><soap:Body><GetListItems xmlns=\"http://schemas.microsoft.com/sharepoint/soap/\"><listName>Jobs</listName>");
    dataSourceString.Append("<Query><Where><Eq><FieldRef Name=\"Title\" /><Value Type=\"Text\">2012_080_A_0</Value></Eq></Where></Query>");
    dataSourceString.Append("<rowLimit>9999</rowLimit></GetListItems></soap:Body></soap:Envelope></SelectCommand><InsertCommand></InsertCommand><UpdateCommand></UpdateCommand><DeleteCommand></DeleteCommand></sharepoint:SoapDataSource>");
    z.DataSourcesString = dataSourceString.ToString();
    manager.SaveChanges(z);
    In my code, I can see the DataSourceString changing, but if I refresh the page it is still loading all the data: why?!

    Hi,
    According to your description, my understanding is that you want to change the data view web part datasource programmatically.
    We need to override the databind method like below:
    public class ExtendedDataFormWebPart : DataFormWebPart
    public override void DataBind()
    this.DataSource = your own data source;
    base.DataBind();
    Here is a detailed code demo for your reference:
    http://jamestsai.net/Blog/post/How-to-query-cross-site-lists-in-DataFormWebPart-Part-1-Build-your-own-data-source-for-DataFormWebPart.aspx
    Best Regards
    Jerry Guo
    TechNet Community Support

Maybe you are looking for