Web Forms :: Change String To A Different String?

Jul 19, 2010

I'm trying to build a web page where the user can send the contents of the web page to someone of their choosing. The email body is html scraped from the website. I have it working, but the the problem is that the image src is relative <img src="/images/filename.jpg"> and I need to make it absolute. What function is the best for me to use on the string that contains my html to make file path absolute in the method I'm trying to create? I tried the following, but am getting error "too many characters in character literal"

reformattedContent.Replace('src="/images/', 'src="http://' + domain + '/images/');

View 8 Replies


Similar Messages:

Forms Data Controls :: Change The Date Format From String To String At Gridview?

Feb 24, 2011

i facing a problem to change the date format at gridview display.

below is my coding:

[code]....

View 2 Replies

Forms Data Controls :: Test Mode Change In Gridview / Stating can't Change String To Decimal?

Sep 14, 2010

When i run the following code i get an error when gridview changes mode to Edit. stating that you can't change string to decimal!

To get around the occurance i want to disable code when in Edit mode or resolve another way?

GridView1_RowDataBound
For Each row As GridViewRow In GridView1.Rows
Dim cell As TableCell = row.Cells(7)
Dim invoicetotal As Decimal = CDec(cell.Text)

View 2 Replies

Web Forms :: Change The IMG SRC String With The Code Behind?

Feb 18, 2010

I m trying to change the img src using the code behind.

A dinamic image that the final user can alter anytime and after this he can send that html content to some email adress.

My trouble is that when I change the image using the code behind the img src doesn't come with html content.

View 2 Replies

Web Forms :: Error Input String Was Not In Correct Exporting HTML String To PDF Using ITextSharp

Jul 20, 2012

 //Read string contents using stream reader and convert html to parsed conent var parsedHtmlElements = HTMLWorker.ParseToList(new StringReader(contents), null);   
//Get each array values from parsed elements and add to the PDF document foreach (var htmlElement in parsedHtmlElements) pdfDoc.Add(htmlElement as IElement);   
//Close your PDF pdfDoc.Close();   Response.ContentType = "application/pdf";   
//Set default file Name as current datetime Response.AddHeader("content-disposition",

[Code] ....

Error: Input string was not in a correct format. Contents in html file giving error ...

View 1 Replies

Web Forms :: Trim Span Long String To Short String Inside Repeater

May 7, 2015

Suppose i am having 25 character length string and I want to bind only first 15 character of that string into the label control.

<a href="[URL]" >"<span class="name" style="text-align: left; font-family: Arial; color: #0094DA; font-size: 14pt">
<%#Eval("Name").ToString().Length >= 30 ? Eval("Name").ToString().Substring(0, 30) : Eval("Name").ToString()%></span></a>

View 1 Replies

Web Forms :: Encrypted String Doesn't Match With Targeted String?

Feb 23, 2011

i have created a encrypted string to match with a target string to pass it along with client URL for authentication. it doesn't match. here is an algorithm used to create a encrypted string.

text = "astringtobeencrypted";
string strglobalkey = "mytestglobalkey";
string hexivkey = "testing12345";
ebCryptLib.eb_c_Cipher ci = new ebCryptLib.eb_c_Cipher();
string strhex1 = ConvertStringToHex(strglobalkey);
string strhex2 = ConvertStringToHex(hexivkey);
byte[] bytes = (byte[])ci.EncryptStringRaw(EB_CRYPT_CIPHER_ALGORITHM.EB_CRYPT_CIPHER_ALGORITHM_DES3_ECB,
strhex1, strhex2, text);
return Convert.ToBase64String(bytes);

the above alogithm returns a string which doesn't match with our targetted string provided by the client.

what should i do to match with the targetted string? The client had generated the encrypted string using PHP.

View 3 Replies

Forms Data Controls :: Replacing All Occurrences Of A String With Another String?

Dec 15, 2010

i have a gridview and i want all occurences of a particular string inside the gridview to be replaced with another string.

View 5 Replies

Web Forms :: Webparts Change The Sql Connection String At Runtime?

Feb 27, 2010

Does anyone has an idea on how to change the connection string of the webparts at runtime. i have a multitenant app, and would like to store each accounts users settings in their respective DB's i tried changing the connstring in the webpartsmanager init, and the page load event

Dim myConfiguration As System.Configuration.Configuration = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("~")

View 1 Replies

Web Forms :: How To Send A String Consists Of (,.&') In A Query String

Dec 7, 2010

Is It Possible to send a string consists of (,.&') in a query string ?

View 7 Replies

Web Forms :: String And StringBuilder - Any Change Updates Memory Location Rather Creating New

Oct 19, 2010

String is immutable and StringBuilder is mutable. So if I change the value of a string a new memory created with the new value, whereas in StringBuilder it updates its memory location rather than creating a new memory location. So for large concatenation stringBuilders are preffered. But when I create a new String object, a fixed memory is created. And any changes will update its memory location, rather than creating a new memory location.

For e.g.
String s = new String();
s = String.Empty;
for ( int i=0;i<100; i++)
{
//s = s + "test" + i.ToString();
s =string.Concat(s, "test" + i.ToString()); ///This is effecient compared to previous step
}

Now instead of String class I will use a StringBuilder class.

StringBuilder s = new StringBuilder(String.Empty);

for ( int i=0;i<100; i++)
{
//s = s + "test" + i.ToString();
s.append( "test" + i.ToString());
}

View 13 Replies

Web Forms :: How To Split The String To String Array

Jan 21, 2010

I would like to split the string to the string array.

but when the string hasn't has the splite sperator, i can't put the string into string array directly.

how to do?

if (Str.Contains(','))
{
str_array=Str.Split(',');
}
else
{
str_array=Str; <-- error occurs at this line.
}

View 3 Replies

Web Forms :: How To Cut String Untill Specific String

Apr 9, 2010

How to cut string untill specific string that determine in asp.net ? Example t=123456789&&ddd=ddddd or t=12345678910&&ddd=ddddd

I want to automatic substring 12346789 and 1234678910 till && symbol.

View 2 Replies

Web Forms :: Timer Control - Reload Page Every 60 Seconds But Change Url Query String Between 3 Values

Aug 27, 2010

I am trying to get my head around the ASP timer control. What I am trying to achieve is to get a page to reload every 60 seconds but change the url querystring everytime between 3 values

i.e. scroll through
server/page.aspx?value=1
server/page.aspx?value=2
server/page.aspx?value=3

how I have though to do this is to use ASP code to grab the querystring value, and then create the next url. But I am having trouble passing that newly created url to a refresh control. im guessing HTML meta refresh is out of the question as I am using a variable. So from what I can see my option is to use the ASP timer control to count down (after the page has loaded) and after 60seconds load the next url.

View 7 Replies

ADO.NET :: Change Connection String Of EDM?

Mar 22, 2011

I have a entity data model generated from a database schema. Now that database is no more physically available, I want to generate a new database with the same schema model. I'm able to generate the tables from the script that the Entity Frame work generates for me.

I have two problems. I'm not able to generate the stored procedures from EDM. Second, I'm not able to change the connection string to the new database. Do I have to re-generate the edm from the new database that I'm trying to create?

View 1 Replies

How To Change Connection String For Mdf Database

Dec 31, 2010

i have create users and rolls and all thing work very good on my computer but after upload view exception

Code:

A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) how can i change connection string for mdf database

View 1 Replies

Change Single URL Query String Value?

Sep 28, 2010

I have an ASP.NET page which takes a number of parameters in the query string:

search.aspx?q=123&source=WebSearch

This would display the first page of search results. Now within the rendering of that page, I want to display a set of links that allow the user to jump to different pages within the search results. I can do this simply by append &page=1 or &page=2 etc.

Where it gets complicated is that I want to preserve the input query string from the original page for every parameter except the one that I'm trying to change. There may be other parameters in the url used by other components and the value I'm trying to replace may or may not already be defined:

search.aspx?q=123&source=WebSearch&page=1&Theme=Blue

In this case to generate a link to the next page of results, I want to change page=1 to page=2 while leaving the rest of the query string unchanged.

Is there a builtin way to do this, or do I need to do all of the string parsing/recombining manually?

View 4 Replies

State Management :: How To Pass Dynamic String Through Query String With Java Script

Dec 24, 2010

I m facing some problem. i m not passing Dynamic string through query string..

I m using this code

string abc = "CPCB_" + TextBox1.Text + "_" + TextBox2.Text;

Response.Write("<script>window.open('xml.aspx?Flag=3&date='+abc,target='new');</script>");

View 2 Replies

Null Reference Using .toString / Convert The Object ConnString (a Connection String) Into A String?

Feb 13, 2010

on VWD 2005 this code works fine, but on 2008 it says I haven't created an instance of the object. I want to convert the object connString (a connection string) into a string.

'This acceses the virtual directory web.config file for connection strings
'We have to convert the object to a connection string
Dim rootWebConfig As System.Configuration.Configuration
rootWebConfig = System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("/VirtualDirec")
Dim connString
As System.Configuration.ConnectionStringSettings
connString = rootWebConfig.ConnectionStrings.ConnectionStrings("ConnectString1")
Dim strConnString
As
String = connString.ToString().......

View 5 Replies

DataSource Controls :: Incorrect String / Format The QueryBuilder String Correctly In Code?

Jul 7, 2010

I'm concatenating a string in codebehind to use in a sql select statement.

in aspx

<asp:Label ID="LabelHidden" runat="server" Visible="False"></asp:Label>
SelectCommand="SELECT * FROM [Data] WHERE [ActivityName] IN (@ActivityName) AND ([ID] = @ID)"
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList_Employees" Name="ID"
PropertyName="SelectedValue" Type="Int32" />
<asp:ControlParameter ControlID="LabelHidden" Name="ActivityName"
Type="String" />
</SelectParameters>
in codebehind
foreach (ListItem li in ListBox_Activities.Items)
{
if (li.Selected)
{
queryBuilder += li + "', ";
}
queryBuilder = queryBuilder.Substring(0, queryBuilder.Length - 1);
LabelHidden.Text = queryBuilder;

When i run the code it comes up blank. I did a query trace and it seems to be running as

exec sp_executesql N'SELECT * FROM [Data] WHERE [ActivityName] IN (@ActivityName) AND ([ID] = @ID)',N'@EmployeeID int,@ActivityName nvarchar(50)',@EmployeeID=4,@ActivityName=N'Production Technical Support'', Tools Development'','

with exta "'s

How can i format the queryBuilder string correctly in my code?

View 3 Replies

C# - Enumerate Keys In In A System.Collections.Generic.Dictionary<string,string>?

Jan 26, 2011

At debug time I would like to see what are the keys in my InitParams collection - I can't seem to be able to list them.

EDIT:As Jon suggests below, this might be a bug within the Silverlight debugger. To reproduce, just create a new Silverlight Application within Visual Studio 2010 and just edit code

{
public partial class MainPage : UserControl
{ [code]...

View 2 Replies

How To Change Configuration Tool Connection String

Jan 10, 2011

how can I change ASP.NET Configuration tool-s connection string name? (Which connection string will ASP.NET Configuration tool will use)

I'm learning ASP.NET and everywhere and in book that I'm reading now theres connection string named: LocalSqlServer.

I want to use my local sql server database instead of sql express to store Roles, Membership and other data.

I have used aspnet_regsql.exe to create needed data structures in my database. after that I changed my web.config to look like:

[code]....

View 1 Replies

Change SqlDataSource Connection String In C# Dynamically

Jun 1, 2010

I have a page in asp.net (web forms) that up until now only had one database for data.

So all the controls that require something from the database use a datasource and the same connection string.

<asp:SqlDataSource id="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:DefaultConnectionString %>"
ProviderName="System.Data.SqlClient"
SelectCommand="SELECT ... ">
</asp:SqlDataSource>

Up until now I only needed one connection string since I had only one database but this has changed since I want some users to connect to database A and others to database B What would be the correct way to go about it?

View 1 Replies

C# - To Change NewReservation.SelectedServiceDate From DateTime To String?

Aug 26, 2010

I'm having problems with the helper Html.ListBoxFor().

Here is my ViewModel:

public class NewReservation
{
public SelectList AvailableServiceDates { get; set; }
public DateTime SelectedServiceDate { get; set; }
}


Here is my action method:

public virtual ActionResult New()
{
NewReservation newReservation = new NewReservation(); [code]....

And in my view:<%:Html.ListBoxFor(x => x.SelectedServiceDate, Model.AvailableServiceDates) %>

Here is the exception: Value cannot be null.

Parameter name: source

Stack Trace: [ArgumentNullException: Value cannot be null. Parameter name: source] System.Linq.Enumerable.Cast(IEnumerable source) +4177011 System.Web.Mvc.Html.SelectExtensions.SelectInternal(HtmlHelper htmlHelper, String optionLabel, String name, IEnumerable1 selectList, Boolean allowMultiple, IDictionary2 htmlAttributes) +723

This post describes the same problem. And like that post, if I change my NewReservation.SelectedServiceDate from DateTime to string, things seem to work. But everything I have read indicates this is a bug that should have been fixed in an MVC2 release candidate.

Am I doing something wrong? I don't want the property's type to be string, it needs to be DateTime. Shouldn't I be able to use objects that reflect my problem?

View 2 Replies

C# - Setup The Connection String Where Only Change It One Place?

Aug 5, 2010

How can I make the code string connStr = ConfigurationManager.ConnectionStrings "staceys_cakesConnectionString"].ConnectionString;

work generically and not need the staceys_cakesConnectionString? Or how can I set it somewhere else so I only have to change it one place when I change it?

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;

[Code]....

View 3 Replies







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