Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   System.Web.UI.HtmlControls.HtmlGenericControl.Cont rols.Add (http://www.velocityreviews.com/forums/t99681-system-web-ui-htmlcontrols-htmlgenericcontrol-controls-add.html)

Martin Eyles 03-31-2005 11:23 AM

System.Web.UI.HtmlControls.HtmlGenericControl.Cont rols.Add
 
Hi,
I have a routine that uses
System.Web.UI.HtmlControls.HtmlGenericControl.Cont rols.Add
quite a lot to add <v:line>, <v:rect> and <div> tags to a document.

Unfortunately, the output HTML markup is VERY messy, as all the tags and
their contents end up on the same line. Is there a way to make it so that
the output is nicely indented, and each tag is on a new line?

(ie. looks like a bit like this)
<div>
<v:line ......>
</v:line>
<v:rect ......>
</v:rect>
<div>
£-83
</div>
</div>

Thanks,
Martin

--
Martin Eyles
martin.eyles@NOSPAM.bytronic.com



=?Utf-8?B?SGl0ZXNo?= 03-31-2005 12:25 PM

RE: System.Web.UI.HtmlControls.HtmlGenericControl.Cont rols.Add
 
hey whereever required you can add new LiteralControl(" "),
new LiteralControl("<br/>")

To have the formatted HTML.

Hope this helps.

"Martin Eyles" wrote:

> Hi,
> I have a routine that uses
> System.Web.UI.HtmlControls.HtmlGenericControl.Cont rols.Add
> quite a lot to add <v:line>, <v:rect> and <div> tags to a document.
>
> Unfortunately, the output HTML markup is VERY messy, as all the tags and
> their contents end up on the same line. Is there a way to make it so that
> the output is nicely indented, and each tag is on a new line?
>
> (ie. looks like a bit like this)
> <div>
> <v:line ......>
> </v:line>
> <v:rect ......>
> </v:rect>
> <div>
> £-83
> </div>
> </div>
>
> Thanks,
> Martin
>
> --
> Martin Eyles
> martin.eyles@NOSPAM.bytronic.com
>
>
>


Martin Eyles 03-31-2005 01:56 PM

Re: System.Web.UI.HtmlControls.HtmlGenericControl.Cont rols.Add
 
"Hitesh" <Hitesh@discussions.microsoft.com> wrote in message
news:D5A24E20-858E-45C2-8098-2AF4B0EB46FA@microsoft.com...
> hey whereever required you can add new LiteralControl(" "),
> new LiteralControl("<br/>")
>
> To have the formatted HTML.


This didn't quite work, but just inserted a space or <br/> in the html. But
I managed to modify it to do what I want. I now do

theGraph.Controls.Add(New LiteralControl(Chr(10)))

which inserts a newline character in the HTML.

Thanks,
ME

--
Martin Eyles
martin.eyles@NOSPAM.bytronic.com



Martin Eyles 04-05-2005 03:48 PM

Re: System.Web.UI.HtmlControls.HtmlGenericControl.Cont rols.Add
 
"Martin Eyles" <martin.eyles@NOSPAM.bytronic.com> wrote in message
news:114o0708hkbu024@corp.supernews.com...
> "Hitesh" <Hitesh@discussions.microsoft.com> wrote in message
> news:D5A24E20-858E-45C2-8098-2AF4B0EB46FA@microsoft.com...
> > hey whereever required you can add new LiteralControl(" "),
> > new LiteralControl("<br/>")
> >
> > To have the formatted HTML.

>
> This didn't quite work, but just inserted a space or <br/> in the html.

But
> I managed to modify it to do what I want. I now do
>
> theGraph.Controls.Add(New LiteralControl(Chr(10)))
>
> which inserts a newline character in the HTML.


To make this neater when run several times, I have tried to split this into
two bits

At the top of the method I set up a literal control object object:-

//Set up a web control to insert a new line into the HTML code.
System.Web.UI.LiteralControl codeNewLine;
codeNewLine=new System.Web.UI.LiteralControl(((char)10).ToString() );

And at several points I insert this line to add the control to another
control:-

theGraph.Controls.Add(codeNewLine); //add a new line to the HTML code.

However, this only appears to work the very last time it is inserted.

Any Ideas?

Thankyou,

Martin

--
Martin Eyles
martin.eyles@NOSPAM.bytronic.com



sasami009 03-27-2009 07:18 AM

sasami009.blogspot.com/2009/03/blog-post_25.html 安全阀调整安全技术操作规程
sasami009.blogspot.com/2009/03/blog-post_23.html 阀门营销实战
sasami009.blogspot.com/2009/03/blog-post_17.html 磁力泵使用六个注意事项
sasami009.blogspot.com/2009/03/blog-post_835.html 泵的主要性能参数
sasami009.blogspot.com/2009/03/blog-post_6684.html 泵的工作原理
sasami009.blogspot.com/2009/03/blog-post_1538.html 泵的分类
sasami009.blogspot.com/2009/03/blog-post_7636.html 泵的发展简史
sasami009.blogspot.com/2009/03/blog-post_16.html 泵的主要用途
sasami009.blogspot.com/2009/03/blog-post.html 泵的定义
sasami009.blogspot.com/2009/02/blog-post_3169.html 管道泵给排水一般选型要求
sasami009.blogspot.com/2009/02/blog-post_4939.html 磁力泵工作原理及注意事项


All times are GMT. The time now is 08:22 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57