How To Replace The Backslash

Sep 9, 2010

I have an image control with the following string

[URL]

I want to replace string cleartext=imagePath.Replace("","/"); but the backslash causes a problem -- how can I replace the backslash?

View 4 Replies


Similar Messages:

C# - How To Avoid The Extra Backslash

Dec 10, 2010

I'm have a page which I sent a parameter through the query string.

If I'm retrieving it with Request.QueryString["Format"] I'm having troubles with the type 'CDDVD'. It's being returned as 'CD\DVD'. It's important I get this as the right string.

How do I avoid the extra backslash? Or even get rid of it later?

View 2 Replies

String Manipulation / Instead Parse Out Last Backslash And Get Filename?

Sep 23, 2010

If I have a file in a path lke this:

C:demo estfile.txt

I can a split function and split on the backslash character to get the pieces. But if my directory could change this wouldn't work. So how would I instead parse out the last backslash and get the filename that way so that it wouldn't matter if the path changed?

View 2 Replies

Web Forms :: Regex.Replace - How To Replace All In A String

Jun 18, 2010

I need to replace <span> entries in a string to legacy html code because it's going to be used in a report for Crystal Reports. <b> works with Crystal, but the<span>'s do not.

Here's the string which I'm trying to replace: <span style="font-weight: bold">%THIS CAN BE ANY TEXT%</span>. I want to replace it to

<b>%THIS CAN BE ANY TEXT%</b>.

[Code]....

View 5 Replies

Web Forms :: C# Replace " With " Using The Replace Method?

Mar 15, 2011

How do you replace" with" using the replace method?

View 5 Replies

When Add Another Row Its Not Generate New Row That Replace Only Old Row?

Jul 21, 2010

i have done dynamic row create using asp:table control..but the problem is when add another row its not generate new row that replace only old row..whenever i count the tr again its take the count zero..here i want no. of row when user done each
button click..

here codes..

[Code]....

View 3 Replies

Web Forms :: How To Replace URL

Jun 4, 2010

We have developed a web based application for data anlysis. we want to hide its working URL's with some custome url.e.g

[URL]

View 7 Replies

How To Replace The Code To CSS

Oct 29, 2010

In a asp.net page, I want to replace the code following to CSS but do not work as expected. How to fix it? (Border-color, ForeColor did note work)

<asp:Label ID="lbl01" runat="server" BorderColor="#B4DAFA" BorderStyle="Solid" BorderWidth="1px" Font-Size="Small" ForeColor="Blue" Style="z-index: 1; left: 3px; top: 10px; position: absolute; height: 14px; width: 325px" Text="Label"></asp:Label>
.LabelStyle
{
clear: left;
float: left;
margin: 5px;
height: 14px;
width: 325px;
Border-Color:#B4DAFA;
Border-Style:Solid;
Border-Width:1px;
Font-Size:Small;
Color:Blue;
}

View 1 Replies

C# - How To Replace Url Value With Regex

Dec 8, 2010

I need a regex or any other solution to replace an id in the middle of a url (not in querystring).
url example - http://localhost:1876/category/6?sortBy=asc&orderBy=Popular

replace - category/6 with category/anotherID -
routing used -
routes.MapRoute(
"categories",
"category/{categoryID}/{categoryName}",
new { controller = "Search", action = "SearchResults", categoryID = "", categoryName = "" }
);

View 1 Replies

Regex.replace [h2] To <h2>?

Aug 25, 2010

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:

[<h2><h2>]test[/<h2><h2>]

So that is not what i want.

After the first 1, he should make:

<h2>test[/h2]

Whats wrong?

View 3 Replies

SilverLight Replace ASP?

Aug 30, 2010

i am new to web development and i am learning Asp.net. i was the other day thinking and i came up with this question. i searched the web but all the answers i found were old so my question is , can silverlight4 replace Asp.net? I know this question sounds crazy . but let's think for moment we use ASP.net to talk to a server.to Create files there ,to talk to a database etc. SilverLight can do the same thing ,right? OK,you might say that if I built a web site using SilverLight then not all users out there can access it. but apparently SilverLight supports IE,FireFox Safari and googleChrome so i guess this isn't an issue anymore. so what do you think ,can silverlight replace asp.net?

View 6 Replies

Asp Replace GenericPrincipal?

May 4, 2010

I was wondering what the best way is to replace the genericPrincipal with my own CustomGenericPrincipal. At the moment I have something like this but I aint sure if it's correct.

protected void Application_AuthenticateRequest(Object sender, EventArgs e)
{
HttpCookie authCookie = Request.Cookies[FormsAuthentication.FormsCookieName];
if (authCookie != null)
{
FormsAuthenticationTicket authTicket = FormsAuthentication.Decrypt(authCookie.Value);
var identity = new CustomIdentity(authTicket);
var principal = new CustomPrincipal(identity);
Context.User = principal;
}
else
{
//Todo: check if this is correct
var genericIdentity = new CustomGenericIdentity();
Context.User = new CustomPrincipal(genericIdentity);
}
}

I need to replace it because I need a Principal that implements my ICustomPrincipal interface because I am doing the following with Ninject:

Bind<ICustomPrincipal>().ToMethod(x => (ICustomPrincipal)HttpContext.Current.User)
.InRequestScope();

So what's the best way to replace the GenericPrincipal?

View 1 Replies

How To Replace Subfolder And Querystring In Url

Mar 17, 2010

I want to change http://localhost:1190/Project/Subfolder/Default.aspx?Query=1

to

http://localhost:1190/Project/Images/Image.jpg

Tried somewhat below, no success:

Request.Url.AbsoluteUri.Replace(Request.Url.AbsolutePath, "") + @"/Images/Image.jpg"));

View 6 Replies

Web Forms :: Replace Address Bar In C#

Oct 14, 2010

i am creating CMS and display the content of every page on a single page when i/user click on any URL the pageid is transferd through query string variable on default.aspx page and content is displayed in div, when value is transfered to default.aspx page the url is like this example [URL] now i want to change it like this................

View 2 Replies

How To Replace As Little As Possible Of The Existing Code

Apr 15, 2010

I am receiving the contents of a file via ftp. I don't want to go into every detail (unless needed), but I am working with existing code that was using 3rd-party software to get ftp files. I am replacing that with .NET code. But I want to replace as little as possible of the existing code that is not specifically using the 3rd-party s/w. So I am trying to use a class originally written by the author of the code (a former employee).

This is his class constructor:

Code:

Public Sub New(ByVal fileName As String, ByVal content As StreamReader)
Me.FileName = fileName
Me.Content = content
Me.TimeStamp = Date.Now
End Sub

So I need to pass a StreamReader. My problem is how to get one.
In my procedure ReceiveFile(), I execute this code:

Code:

Private Shared Sub ReceiveFile(ByVal sFilename As String, ByRef objMemoryStream As System.IO.MemoryStream)
Try

Dim request As FtpWebRequest = DirectCast(WebRequest.Create("ftp site and folder" & sFilename), FtpWebRequest)
request.Method = WebRequestMethods.Ftp.DownloadFile
request.Credentials = New NetworkCredential("id", "pw")
Dim response As FtpWebResponse = DirectCast(request.GetResponse(), FtpWebResponse)
Dim responseStream As Stream = response.GetResponseStream()
Dim reader As New StreamReader(responseStream)
Dim sFile As String = reader.ReadToEnd
'reader.Close()
' response.Close()
'objMemoryStream = responseStream
Dim objStream As System.IO.MemoryStream
objStream = New System.IO.MemoryStream(Convert.FromBase64String(sFile))
' objMemoryStream = Convert.FromBase64String(sFile)
objMemoryStream = objStream
'Return reader
Catch ex As Exception
Dim i As Integer
i = 10
End Try
End Sub

responseStream is declared as a stream but when I query it in the debugger it says it's an FtpDataStream, after it's set equal to response.GetResponseStream. I want to take that stream and somehow get it into a MemoryStream. I thought I found the solution this morning via Convert.FromBase64String, but when I ran I got an exception saying "Invalid character in a base-64 string", and I think it's because of the newline character in the string. The file that's received contains three lines separated by a newline character.

View 22 Replies

C# - . To Replace Any LABELs With LITERALs

Jul 22, 2010

I just wanted to hear some authorities on when and where you should use a LITERAL control over a LABEL. As I understand it, the difference is this: A LABEL can be styled via the <SPAN> tags that are added.

I personally find the addition of <SPAN> tags in my HTML to be very annoying and never actually apply styles through ASP, and so LITERALs seem to be what should be used most of the time... but I'm concerned there's other considerations or benefits to using a LABEL over it that I'm unaware of.

Is it 100% completely fine to replace any LABELs with LITERALs, provided we're not applying styles to them? Are there NO other considerations?

View 2 Replies

Regex To Replace Specific Div?

Feb 8, 2010

with a regex that would replace the following. The only thing that would remain the same is the div tags, the id's and classes could change and so could the content.

<div id="nav" class="whatever">Content is whatever</div>

View 4 Replies

C# - Regex Replace - But With A Few Exceptions?

Mar 11, 2010

string lNewHTML = Regex.Replace(lOldHTML, "(word1|word2|word3)", "<a href="page.aspx#$1">$1</a>", RegexOptions.IgnoreCase);

The code works, but I need to include some exceptions to the replace - e.g. I will not replace anything i an img-, li- and a-tag (including link-text and attributes like href and title) but still allow replacements in p-, td- and div-tags.

View 2 Replies

Search And Replace String Value?

Jun 9, 2010

I have a string variable contain text that I would like to search for "Keyword" and replace it with new value.

For example:

Dim strValue = " col1 = "John" and col4 = "smith" or col7 <> "closed" or col9 > 1 and col5 = "passed" "

After the replace the strValue should be :

strValue = " col1 = "John" and ( col4 = "smith" or col7 <> "closed" or col9 > 1 ) and col5 = "passed" "

View 13 Replies

Using RegEx Replace Function In C# ASP?

Feb 18, 2010

How do I solve the problem below? I'm creating a simple content management system, where there is a HTML template with specific markup that denotes where content should be:

<html><head></head><body><!-- #Editable "Body1" --><p>etc etc</p><!-- #Editable "Extra" --></body></html>

Separate from this, there is content in a database field that looks a little like this:

<!-- #BeginEditable "Body1" -->This is Test Text<!-- #EndEditable --><!-- #BeginEditable "Extra" -->This is more test text<!-- #EndEditable -->

As you can guess I need to merge the two, that is, replacing

<!-- #Editable "Body1" -->

with: This is Test Text. I've begun the code here. But I'm having problems using the Regex Replace function that should be located at the very bottom of that For/Each.

//Html Template
string html = "<html><head></head><body><!-- #Editable "Body1" --><p>etc etc</p><!-- #Editable "Extra" --></body></html>";
//Regions that need to be put in the Html Template
string regions = "<!-- #BeginEditable "Body1" -->This is Test Text<!-- #EndEditable --><!-- #BeginEditable "Extra" -->This is more test #EndEditable -->";
//Create a Regex to only extract what's between the 'Body' tag
Regex oRegex = new Regex("<body.*?>(.*?)</body>", RegexOptions.Multiline);
//Get only the 'Body' of the html template
string body = oRegex.Match(html).Groups[1].Value.ToString();
// Regex to find sections inside the 'Body' that need replacing with what's in the string 'regions'
Regex oRegex1 = new Regex("<!-- #Editable "(.*?)"[^>]*>",RegexOptions.Multiline);
MatchCollection matches = oRegex1.Matches(body);
// Locate section titles i.e. Body1, Extra
foreach (Match match in matches)
{
string title = oRegex1.Match(match.ToString()).Groups[1].ToString();
Regex oRegex2 = new Regex("<!-- #BeginEditable "" + title + ""[^>]*>(.*?)<!-- #EndEditable [^>]*>", RegexOptions.Multiline);
//
//
// Replace the 'Body' sections with whats in the 'regions' string cross referencing the titles i.e. Body1, Extra
//
//
//
}

View 5 Replies

Replace Column Value With Description?

May 27, 2010

How to replace cell value with their description. This is my grid

<telerik:RadGrid ID="RadGrid1" runat="server" DataSourceID="SqlDataSource1" GridLines="None">
<HeaderContextMenu EnableAutoScroll="True">
</HeaderContextMenu>
<MasterTableView AutoGenerateColumns="False" DataKeyNames="OrderID" DataSourceID="SqlDataSource1">
<RowIndicatorColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</RowIndicatorColumn>
<ExpandCollapseColumn>
<HeaderStyle Width="20px"></HeaderStyle>
</ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn DataField="OrderID" DataType="System.Int32" HeaderText="OrderID"
ReadOnly="True" SortExpression="OrderID" UniqueName="OrderID">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="CustomerID" HeaderText="CustomerID" SortExpression="CustomerID"
UniqueName="CustomerID">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="OrderDate" DataType="System.DateTime" HeaderText="OrderDate"
SortExpression="OrderDate" UniqueName="OrderDate">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="RequiredDate" DataType="System.DateTime" HeaderText="RequiredDate"
SortExpression="RequiredDate" UniqueName="RequiredDate">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ShipName" HeaderText="ShipName" SortExpression="ShipName"
UniqueName="ShipName">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ShipAddress" HeaderText="ShipAddress" SortExpression="ShipAddress"
UniqueName="ShipAddress">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ShipCity" HeaderText="ShipCity" SortExpression="ShipCity"
UniqueName="ShipCity">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ShipRegion" HeaderText="ShipRegion" SortExpression="ShipRegion"
UniqueName="ShipRegion">
</telerik:GridBoundColumn>
telerik:GridBoundColumn DataField="ShipPostalCode" HeaderText="ShipPostalCode" SortExpression="ShipPostalCode"
UniqueName="ShipPostalCode">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="ShipCountry" HeaderText="ShipCountry" SortExpression="ShipCountry"
UniqueName="ShipCountry">
</telerik:GridBoundColumn>
</Columns>
</MasterTableView>
</telerik:RadGrid>

This grid will load Orders table. How to replace CustomerID with CompanyName which is come from Customers table during run time?

View 2 Replies

C# - Replace Image In Code Behind

Jul 29, 2010

I have a page, which is called from 2 different functions. For each function, the page has to be display different image. I have 2 images. On the aspx page, code is like this. Please help me out how to display different image for different functions!

View 1 Replies

How To Replace Characters In String

Dec 1, 2010

i have a string and want to remove text up to the last forward slash, e.g

/images/UserThumbnails/22.jpg
Should now be
22.jpg

How do i go about doing this?

View 2 Replies

SQL Server :: Replace All In Sql Table?

Aug 2, 2010

i need one query replace all in table.. example of one table have null value replace in "000" .. but null value not only in single column .. it is present in more column.. i need single query... below query only for replace in single column...."SELECT REPLACE(salary, 'null', '000')as new from salary"

View 9 Replies

Works With WPF And Replace Win Forms?

Mar 1, 2010

i am posed like a question like this will asp.net works with WPF? is this correct like wpf is going to replace win forms and asp.net in future??

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved