.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 in XML via VB

Posted By:      Posted Date: September 18, 2010    Points: 0   Category :ASP.Net
Hi,How i can replace XML childnode with some other value in asp.net using VB lanuage?For the examle in below code i need to replace all datasource withProtected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click Dim findstr as string Dim doc = XDocument.Load(Server.MapPath("test1.xml")) For Each results In doc.<main>.<tab>.<frmControls>.<formfield>.<datasource> findstr = results.ToString() 'Then replace findstr to the <option id="1" value="Yes" /> <option id="2" value="No"> <option id="3" value="May Be"> Next End Sub Thank YouHI, How i can replace XML childnode with some other value in asp.net using VB lanuage? For the examle in below code i need to replace all datasourc

View Complete Post

More Related Resource Links

Can I replace the EntityObject as base-class in Entity Designer 3.5 sp1?


I'm using EF3.5sp1 for a project, and I've been working around many of its problems... as such, my entity partial classes have a lot of logic in them for change-tracking and whatnot.  Obviously, I'd like to factor this logic out into a common base class, but of course all my objects must derive from EntityObject.  Is it possible to tell them to derive from some class of my own invention (which would actually likely derive from EntityObject themselves)?

I'd rather avoid editing the EDMX file unless the changes will be safe on entity-model-update, since I'm still making changes to the database schema in this early state of my project.


Also, is there any good workaround for the fact that the change isn't tracked when you change EntityReference.EntityKey?

Regex.replace [h2] to


I try to replace [h2] to <h2>
I use this coding:

string o = "<h2>test</h2>";
o = Regex.Replace(o, "[h2]", "<h2>");
o = Regex.Replace(o, "[/h2]", "</h2>");


But the result after the first regex is:


So that is not what i want.
After the first 1, he should make:


Whats wrong?

Replace text in a word document stored in a Document Library


Hi to all,

im tying to replace some text introduced in a word document stored in a document library.

Exactly i need a web part with a button that change a key in a word template <list> (for example) and replace <list> with a text in another list.


I think that it would works with the Microsoft.Office.Word.Interop; namespace but when i call the function :

wDoc = wordApp.Documents.Open(ref fileName, ref missing,
                                ref readOnly, ref missing, ref missing, ref missing,
                                ref missing, ref missing, ref missing, ref missing,
                                ref missing, ref isVisible, ref missing, ref missing,

The replace of web application stress tool

Hi i want  know in 2010 what is the replace of web application stress tool. what is the new tool for testing application , not Microsoft test manager,  with out a tema foundatin server a application like jmeter   thamks

Change case using Find & Replace dialog box

Hi, I want to change case of link URLs using Find & Replace dialog box . Is it possible? eg changing http://www.abc.com/S pecial-E dition.aspx, http://www.abc.com/O ther-N ews.aspx to http://www.abc.com/s pecial-e dition.aspx, http://www.abc.com/o ther-n ews.aspx

Find and replace link source

I want to replace links href in the source code using regular expression in Find/Replace dialog box from http://www.abc.com/car-news/13PX5S/News1.aspx, http://www.abc.com/car-news/27JXW5/News2.aspx to http://www.abc.com/car-news/news1/13px5s/, http://www.abc.com/car-news/news2/27jxw5/   - in the resultant URL there will be no Capital letters.    

Replace Text in textbox in word document using interop and asp.net

Hi all,  I'm trying to create a function to replace fields in a word document using asp.net. The fields are marked in the document using ###field### and I need to replace them with the data from the DB. The code I have works fine for the body of the word document but doesn't appear to work if the text is contained within a textbox, is there a way to correct this? Here's the code I am currently using Dim Contract as string Dim word As New Word.Application        Dim doc As Word.Document        Try            word.Documents.Open("c:\FYI.doc")            word.Visible = True             doc = word.ActiveDocument            Dim myStoryRange As Microsoft.Office.Interop.Word.Range            For Each myStoryRange In doc.StoryRanges                With myStoryRange.Find                    .Text = "###field###&quo

Patch for VS 2010 Find and Replace Dialog Growing

One of the top reported Microsoft Connect issues with VS 2010 has been an issue with the Find and Replace dialog - which grows 16px each time you use it (which is pretty annoying). The Visual Studio team recently released a patch that fixes this issue. You can download and apply it here. Hope this helps, Scott P.S. A few people reported issues installing the patch if they had an older version of the Silverlight 4 tools installed.  If you see an error message that says you need an update to Visual Studio to support Silverlight 4, you can fix it by installing the latest Silverlight 4 tools release.

Replace in SQL

Using SQL I want to replace every second instance of a charactor of a string with another value. For example:   qwrwqr|qweqwe|fasf|as|asdasd|asdadefgew|tujytjy|werwe| qwrwqr|qweqwe=fasf|as=asdasd|asdadefgew=tujytjy|werwe=   How would I accomplish this in a UDF or SP?   J        

String.Replace With wildcard (and use whatever "wildcard" is)

Hello there,I'm hoping someone out there know a way to accomplish what I'm trying to do, because I'm currently stuck :) What I want to do is to replace lets say ##test## with Something(test)..I know that I can find ##test## by: (Though don't know whether there's a smarter way)System.Text.RegularExpressions.Regex.Replace(str, "##Test.*##", "Output")So basically the problem is to get what the wildcard (.*) is, since thats really what I need to know..Anyone with a brilliant idea how to accomplish this?

Regular expression: Replace anything that isn't alphanumeric with a space?

Hi there,I'm writing a function in C# that will clean up a filename that a user might upload.One of the requirements is to replace any character that isn't alphanumeric with a space, but I can't seem to get the regular expression working to do so?I've include my code below, thanks for any help :)// Replace miscellaneous characters with a space inputFilenameRegex = new Regex(@"^[a-zA-Z0-9]"); inputFilename = inputFilenameRegex.Replace(inputFilename, " ");

themeable css in sharepoint foundation not perfroming the replace.

I have the following code and it is getting applied but it is not performing the replace. It loads the gray wp header  but never does the replace. Any ideas?  I really want the image recolor to work but when that did not work i thought i would try something simpler. image recolor code is at bottom. Thanks in advance.  tr.ms-WPHeader td + td /* [ReplaceColor(themeColor:"Dark2-Darker")] */ background-color: #999999; } .ms-WPHeader { /* [ReplaceColor(themeColor:"Dark2-Darker")] */ background-color: #999999; } .ms-WPTitle { /* [ReplaceColor(themeColor:"Dark2-Darker")] */ color: #ffffff !important; background-color: #999999; }   Here is the image recolor.  The image shows but not the new color when a theme is selected. /* [RecolorImage(themeColor:"Accent1-Darkest",method:"Tinting")] */ background: url(/_layouts/gp_custom/images/blue_element.jpg) repeat-x 0px 0px;

Replace string in xml without converting to varchar using SQL Server

We have a xml datatype in SQL server which gets a xml file loaded into it. We want to replace some of the content in the xml datatype, but are running into problems converting from xml to varchar(for manipulation purposes), back to xml to output. Does anyone know of a way to replace xml without converting to varchar?Thanks in advance

Replace EditableTextBox in ComboBox

I would like to replace the inner TextBox of a ComboBox if the ComboBox is set to "IsEditable". I tried something like: <ControlTemplate TargetType="{x:Type controls:myComboBox}"> <ControlTemplate.Triggers> <Trigger Property="IsEditable" Value="true"> <Setter TargetName="PART_EditableTextBox" Property="Template" Value="{StaticResource Editable}"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> but I get an error: ".. Cannot find the Trigger target 'PART_EditableTextBox'.  .." What have I done wrong?

find and replace linebreaks in file read from disk

I have a css file which I want to read from disk and in that content I want to find and replace all linebreaks (do I look for vbCrlf or ...?)   Public Shared Function GetFileContents(ByVal FullFilename As String) As String        Dim filecontents As String = ""        If File.Exists(FullFilename) Then            Dim objStreamReader As StreamReader            objStreamReader = File.OpenText(FullFilename)            filecontents = objStreamReader.ReadToEnd()            objStreamReader.Close()        End If       Return filecontents    End FunctionSo in the returned variable "filecontents" I want to find and replace any linebreaks.        FILE: style.css#progress{color:#000;width:500px;height:30px;padding:0px;clear:both;}#progress ul{list-style:none;padding:0px;margin: auto;display:block;}#progress ul li{list-style:none;display:inline;float:left;width:auto;height:30px;padding:0px;line-height:30px; font-family:Arial, Helvetica, sans-serif; font-size:13px;}

replace empty string with value if it is empty in ssrs

I need to place a "Days Not Calculated" of the string is empty, if it is not empty then a need to use the days calculated and put "days old" on the end of the number....SSRS 2K5 iif (Fields!AGE.Value, "", "Days Not Calculated")& " Days Old "

what does the @ in string.Replace(@"\'","") do?

hi,can anybody please explain me what does the @ character in the function above do?thanks guys
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