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


Top 5 Contributors of the Month
david stephan
Asad Ali
Post New Web Links

how to break line while assigning value using Javascript

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

hi all ;

i ve a string like

var Ans="a<br>b<br>c";

wen i assigned input using document.getElementById(id).value = Ans;

it display input as it is

i wanna show input lyk 

a

b

c

i am tryin to replace <br>wit "\n" but it is not working... it is showing 

a<br>b<br>c or

a\nb\nc\n






View Complete Post


More Related Resource Links

Line Break Problem in XSLT

  

Hi All,

I want to add line break in the xslt but it not working.

Below is the code for adding the line break.

</P> <P>
&lt;xsl:variable name="Collection7"&gt;</P> <P>&nbsp; &lt;xsl:value-of select="$13932"/&gt;&lt;xsl:text&gt;&amp;#xa;&lt;/xsl:text&gt;</P> <P>&nbsp; &lt;xsl:value-of select="$31042"/&gt;&lt;xsl:text&gt;&amp;#xa;&lt;/xsl:text&gt;</P> <P>&lt;/xsl:variable&gt;</P> <P>&lt;td&gt;&lt;xsl:value-of select="$Collection7"/&gt;&lt;/td&gt; </P> <P>&lt;/code]</P> <P>I have tried the below code as well:</P> <P>&lt;xsl:variable name="newline"&gt;
&lt;xsl:text&gt;
&lt;/xsl:text&gt;
&lt;/xsl:variable&gt;</P> <P>or</P> <P>&lt;xsl:variable name="break"&gt;&amp;lt;br&amp;gt;&lt;/xsl:variable&gt;</P> <P>or </P> <P>addign &lt;br/&gt;</P> <P>then also it not adding the line break.</P> <P>But If I write code like below then it is adding the line break and it works fine.</P> <P>

Mission Impossible? Use Javascript to Disable a Multi-Line Rich Text Field

  

Hey Community,

Here's a tough one that I have struggled with and so far have not been able to find an answer for - how do you use Javascript to disable a multi-line rich text field.  I have customized a SP Edit form by adding a CEWP.  In the CEWP I have added the Javascript below (only a partial code sample provided) to disable several fields in the form.  The code works fine for single line text fields but it does not work for multi-line rich text fields.  Any suggestions?

<script language="javascript">
//This runs the function when the form first loads
_spBodyOnLoadFunctionNames.push("lockFields");

//This locks the fields the users should not modify
function lockFields()
{
  var theInputTFTitle = getTagFromIdentifierAndTitle("Input","TextField","Title");
  theInputTFTitle.readOnly = true;
  theInputTFTitle.style.color = 'gray';
  //alert(" Value: " + theInputTFTitle.value);//for testing

   var theInputDDLReplyStatus = getTagFromIdentifierAndTitle("select","DropDownChoice","Reply Status");
  theInputDDLReplyStatus.disabled = true;
  //alert(" Value: " + theInputDDLReplyStatus.value);//for testing

  var theInpu

Break points in javascript

  
Hi, I am using Visual Studio 2010 and I need to debug javascript. If I put breakpoint in .js file, when that breakpoint is hit, debugger pauses execution and I can continue statement by statement. But if I put that breakpoint inside script tag directly in page, debugger doesn`t stop on that breakpoint. If I put that breakpoint in the same line but not in source page (.aspx), but into that dynamically created, it works. Problem looks to me that it doesn`t take breakpoints from original file, so I need to put breakpoints into that dynamic file each time I press F5. Can I fix it? Thanks

Paragraph and Line Break Characters

  
Hello Everyone. While coding my website, I ran into a strange oddity that I can not figure out.  I was working with the MasterPages file and had some fat fingers, thus hitting a few strange keys.  I don't have any idea which ones they were exactly.  After continueing on the coding, I later noticed that my paragraphs were not displaying as they usually do.  Normally, I can have the following code:<p />This is paragraph one. <p />This is paragraph two.  This would show up like a standard set of paragraphs, with a single empty line in between.  After hitting the unknown keys in Visual Studio, the paragraphs no longer work as expected.  I've had to change my HTML to...<p>This is paragraph one.</p> <br /> <p>This is paragraph two.</p> I'm not particularly opposed to either way, however, the problem has arisen that the page viewed over my mobile phone doesn't view the same as over the computer.  There are now several extra lines between paragraphs.   What did I do wrong?  I've recreated the page from scratch and I've looked at all the properties I can find.  Google has been no help at all. Thanks in advance! P.S.  You can see the exact same page displayed Content Text using different MasterPages atHttp://Www.McsoPosseResources.Org/Http://Www.McsoP

Line Break within a Cell?

  
I am creating a "contract" via SRS 2008 in which I will pass contract sections as text into a table on the report.  In some cases the cell within the table will have 4-5 lines of text.  In other cases the cell may have 70 - 80 lines of continuous verbiage.  How do I get the report to page break and put some of the text on 1 page and the rest on a second page?
Jim

Line break after div, but not before

  

Hi!

I have list of products that I want to display in a list with three products on each row and I want to use plain css, not a table based design.

I've tried a class with display:block on every third product, and with display:table-cell on the products before. Can you do a line break after a div, but not before?

I know that a table would be best, but due to certain circumstances this is not an option.

Best regards,


Javascript asking for break, continue or ignore

  

Hi,

This is Naveen, i am trying to upgrade a internal website from .Net 1.1 to .Net 2.0 in VB.

but the code is giving an exception in explorer the same code doesn't give exception in explorer,in the same time it doesnot work roperly..

when i try change the values in text boxes an exception is occured as

"Microsoft JScript runtime error: 'document.Form1.txtRentalCost' is null or not an object" with break continue and ignore options.


here is my JavaScript:


<script language="javascript" type="text/javascript">
    function Recalculate()
    {
        document.Form1.txtRentalCost.value = parseFloat(document.Form1.txtRentalPerDay.value) * parseInt(document.Form1.txtNumOfDays.value) * parseInt(document.Form1.txtRate.value) / 100;
    } 
</script>

.

.

in explorer:- giving exception.

in firefox:- multiplication is not working.

.

<input id="txtRentalCost" style="z-index: 114; left: 344px; width: 139px; position: absolute;
            top: 208px; height: 22px" type="text" size="17" name="txtRentalCost" runat=&

multiple line javascript alert in codebehind c#

  

I'm trying to put line breaks in my alert that's in a Response.Write like this:

 

Response.Write("<script>alert('" + dr["display_title"].ToString() + "\n is " + dr["display_title"].ToString().Length + " characters. Title cannot exceed 100 characters. Please limit all titles to 100 characters or less.')</script>");

 

with the \n  character, but instead of the alert showing up on multiple lines in the dialog box, the alert itself is breaking up into multiple lines like this:

alert('some text

more text

more text')

 

How would I get this to work correctly? Thanks


Insert "

" at each line break in a rich text box c# 2010

  

I want to type a letter in a rich text box and have it converted to html format for bulk email send to customers. Ideally I want to add "</p><p> at each line break, but right now i'd be happy to simply replace the line breaks.

When i run the text through

Int32 n = 0;

string s = EmailBodyRichTextBox.Text;

string t = "";

foreach (char c in s)

Javascript New line

  

Hi,

In application i have button placed inside the updatepanel, from the button click event i am firing a javascript alert using "ScriptManager.RegisterStartupScript",

 

every thing work perfect except when you add new line char (\\r\\n), but i need to add new line in script ,

 

Please help,

 


ASP.NET, HTML, JavaScript Snippet Support (VS 2010 and .NET 4.0 Series)

  
This post covers another useful improvement in VS 2010 - HTML/ASP.NET/JavaScript snippet support. Snippets allow you to be more productive within source view by allowing you to create chunks of code and markup that you can quickly apply and use in your application with a minimum of character typing.

Visual Studio has supported the concept of "snippets" for VB and C# in previous releases - but not for HTML, ASP.NET markup and JavaScript. With VS 2010 we now support snippets for these content types as well.

call JavaScript - jQuery code from ASP.NET Server-Side

  
jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side.

call JavaScript - jQuery code from ASP.NET Server-Side

  
jQuery got so close to me lately that I can see myself adding the scripts to my project almost unconsciously. The thing is, jQuery is very useful for me, in almost all situations and it has been a do or die enhancement for all my project since I first put my hands on it.

Of course while using it, you encounter few situations which need a bit of research to solve, mostly when you are trying to combine it with some other technologies like: UpdatePanels and ASP.NET Ajax. For instance there are many situations when I would like to run some jQuery magic based on some decision that I make on the server side

Ajax Enabled Gridview using JavaScript in ASP.NET

  
Before explaining the article, I would like to thank all readers who read my article and voted for it. Your appreciation for my article gives me strength to write more good articles. Hope in future I will get your valuable comments and suggestions. Now I won't waste your time and come back to the topic. I have written this article on 'Ajax Enabled Gridview Using JavaScript in ASP.NET'. In this article, I will show you how to make a Gridview using a simple HTML table, JavaScript and XML HTTP for Ajax call without using any ASP.NET control.

Using Code

GridView Javascript Click Row and Ajax

  
This article shows 2 common tasks with the ASP.NET GridView: Binding a List (generic) of objects as DataSource and on clicking a row, getting the values of the selected row by a javascript function. In the example a List with User-objects is displayed. On clicking a row containing the data of a User-object, the Id of the object is used to get the address of the user by an Ajax-call and display it in a details-field.

Combine, minify and compress JavaScript files to load ASP.NET pages faster

  
Websites are getting more interactive these days and most of this interactivity comes from JavaScript. People are using different JavaScript libraries and frameworks to make their websites more interactive and user friendly.

how to impose javascript event processing?

  

If I have some form control like textbox and I want the event handler to be located in the html instead of at the server side, how to do that? Of course I can copy paste javascript code in the aspx file. But is it possible to do that using some object oriented approach (ie programmatically in the code behind)?

Thanks


Categories: 
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