Showing posts with label formatting. Show all posts
Showing posts with label formatting. Show all posts

Thursday, March 29, 2012

HTML formatting question in datagrid pager area.

I know it's dumb ... sometimes frustrating
I want the text and a dropdownlist align with both side of a table cell,
i.e. text align left and dropdownlist align right. I cannot add more cells t
o
do format because it's in a Datagrid pager area. The html code generated for
pager is one sigle cell with lots of colspan.
I tried to add some html elements in between text and dropdownlist, for
example table iframe and p but I cannot achieve the exact result.
<td colspan="3" >1 2 3 4 5 6 <nobr><iframe width="70%" height="0"
style="display:inline"></iframe>
<select>
<option selected="selected" value="10">10</option>
<option value="25">25</option>
<option value="50">50</option>
</select></nobr></td>
Any help?
BTW my last question about adding dropdownlist to pager works fine. Thanks
the reply.Hi,
I think you have to control the column spans yourself. So, wipe out the
spans and insert your own cells. Here's the idea in code with comment
inline. Let us know if this helps?
Ken
Microsoft MVP [ASP.NET]
Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
DataGrid1.AllowPaging = True
DataGrid1.PageSize = 3
If Not IsPostBack Then
DataGrid1.DataSource = CreateDataSource()
DataGrid1.DataBind()
End If
End Sub
Private Sub DataGrid1_ItemCreated _
(ByVal sender As Object, ByVal e As _
DataGridItemEventArgs) Handles DataGrid1.ItemCreated
' Insert text and ddl columns in the pager cell
' by Ken Cox - Microsoft MVP [ASP.NET]
' Check that we are dealing with the pager row
If e.Item.ItemType = ListItemType.Pager Then
' declare the variables we'll need
Dim lstItem As DataGridItem
Dim cmbBox As New DropDownList
Dim txtcell As New TableCell
Dim cmbcell As New TableCell
Dim oldcell As New TableCell
' Get a reference to the datagrid item (row)
lstItem = e.Item
' Get a reference to the current pager cell
oldcell = e.Item.Cells(0)
' Set the current pager cell to span two columns
oldcell.ColumnSpan = 2
' Align the pager elements to the centre
oldcell.HorizontalAlign = HorizontalAlign.Center
' Clear out existing cells in the pager
lstItem.Cells.Clear()
' Put some text in the text cell
txtcell.Text = "Text Here"
' Create a dropdownlist box and add some items
cmbBox.Items.Add("Red")
cmbBox.Items.Add("Green")
' Add the ddl to the controls collection
' of the cell
cmbcell.Controls.Add(cmbBox)
cmbcell.ColumnSpan = 1
' Set the cell alignment to right
cmbcell.HorizontalAlign = HorizontalAlign.Right
' Add the text cell to the datagrid item's Cells collection
lstItem.Cells.Add(txtcell)
' Add the original item to the Cells collection
lstItem.Cells.Add(oldcell)
' Add the cell with the ddl to the collection
lstItem.Cells.Add(cmbcell)
End If
End Sub
Function CreateDataSource() As ICollection
Dim dt As New DataTable
Dim dr As DataRow
dt.Columns.Add(New DataColumn _
("IntegerValue", GetType(Int32)))
dt.Columns.Add(New DataColumn _
("StringValue", GetType(String)))
dt.Columns.Add(New DataColumn _
("PercentValue", GetType(Double)))
dt.Columns.Add _
(New DataColumn("Boolean", GetType(Boolean)))
Dim i As Integer
For i = 0 To 8
dr = dt.NewRow()
dr(0) = i
dr(1) = "Item " + i.ToString()
dr(2) = 0.23 * (i + 1)
dr(3) = True
dt.Rows.Add(dr)
Next i
Dim dv As New DataView(dt)
Return dv
End Function 'CreateDataSource
<asp:datagrid id="DataGrid1" runat="server"></asp:datagrid>
"strout" <strout@.discussions.microsoft.com> wrote in message
news:60C11B35-70C1-4620-BE7B-CBD603456B7D@.microsoft.com...
>I know it's dumb ... sometimes frustrating
> I want the text and a dropdownlist align with both side of a table cell,
> i.e. text align left and dropdownlist align right. I cannot add more cells
> to
> do format because it's in a Datagrid pager area. The html code generated
> for
> pager is one sigle cell with lots of colspan.
> I tried to add some html elements in between text and dropdownlist, for
> example table iframe and p but I cannot achieve the exact result.
> <td colspan="3" >1 2 3 4 5 6 <nobr><iframe width="70%" height="0"
> style="display:inline"></iframe>
> <select>
> <option selected="selected" value="10">10</option>
> <option value="25">25</option>
> <option value="50">50</option>
> </select></nobr></td>
> Any help?
> BTW my last question about adding dropdownlist to pager works fine. Thanks
> the reply.

HTML formatting question in datagrid pager area.

I know it's dumb ... sometimes frustrating

I want the text and a dropdownlist align with both side of a table cell,
i.e. text align left and dropdownlist align right. I cannot add more cells to
do format because it's in a Datagrid pager area. The html code generated for
pager is one sigle cell with lots of colspan.

I tried to add some html elements in between text and dropdownlist, for
example table iframe and p but I cannot achieve the exact result.

<td colspan="3" >1 2 3 4 5 6 <nobr><iframe width="70%" height="0"
style="display:inline"></iframe>
<select>
<option selected="selected" value="10">10</option>
<option value="25">25</option>
<option value="50">50</option>
</select></nobr></td
Any help?

BTW my last question about adding dropdownlist to pager works fine. Thanks
the reply.Hi,

I think you have to control the column spans yourself. So, wipe out the
spans and insert your own cells. Here's the idea in code with comment
inline. Let us know if this helps?

Ken
Microsoft MVP [ASP.NET]

Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
DataGrid1.AllowPaging = True
DataGrid1.PageSize = 3
If Not IsPostBack Then
DataGrid1.DataSource = CreateDataSource()
DataGrid1.DataBind()
End If
End Sub
Private Sub DataGrid1_ItemCreated _
(ByVal sender As Object, ByVal e As _
DataGridItemEventArgs) Handles DataGrid1.ItemCreated
' Insert text and ddl columns in the pager cell
' by Ken Cox - Microsoft MVP [ASP.NET]

' Check that we are dealing with the pager row
If e.Item.ItemType = ListItemType.Pager Then

' declare the variables we'll need
Dim lstItem As DataGridItem
Dim cmbBox As New DropDownList
Dim txtcell As New TableCell
Dim cmbcell As New TableCell
Dim oldcell As New TableCell
' Get a reference to the datagrid item (row)
lstItem = e.Item
' Get a reference to the current pager cell
oldcell = e.Item.Cells(0)
' Set the current pager cell to span two columns
oldcell.ColumnSpan = 2
' Align the pager elements to the centre
oldcell.HorizontalAlign = HorizontalAlign.Center
' Clear out existing cells in the pager
lstItem.Cells.Clear()
' Put some text in the text cell
txtcell.Text = "Text Here"

' Create a dropdownlist box and add some items
cmbBox.Items.Add("Red")
cmbBox.Items.Add("Green")
' Add the ddl to the controls collection
' of the cell
cmbcell.Controls.Add(cmbBox)
cmbcell.ColumnSpan = 1
' Set the cell alignment to right
cmbcell.HorizontalAlign = HorizontalAlign.Right

' Add the text cell to the datagrid item's Cells collection
lstItem.Cells.Add(txtcell)
' Add the original item to the Cells collection
lstItem.Cells.Add(oldcell)
' Add the cell with the ddl to the collection
lstItem.Cells.Add(cmbcell)

End If
End Sub

Function CreateDataSource() As ICollection
Dim dt As New DataTable
Dim dr As DataRow
dt.Columns.Add(New DataColumn _
("IntegerValue", GetType(Int32)))
dt.Columns.Add(New DataColumn _
("StringValue", GetType(String)))
dt.Columns.Add(New DataColumn _
("PercentValue", GetType(Double)))
dt.Columns.Add _
(New DataColumn("Boolean", GetType(Boolean)))
Dim i As Integer
For i = 0 To 8
dr = dt.NewRow()
dr(0) = i
dr(1) = "Item " + i.ToString()
dr(2) = 0.23 * (i + 1)
dr(3) = True
dt.Rows.Add(dr)
Next i
Dim dv As New DataView(dt)
Return dv
End Function 'CreateDataSource

<asp:datagrid id="DataGrid1" runat="server"></asp:datagrid
"strout" <strout@.discussions.microsoft.com> wrote in message
news:60C11B35-70C1-4620-BE7B-CBD603456B7D@.microsoft.com...
>I know it's dumb ... sometimes frustrating
> I want the text and a dropdownlist align with both side of a table cell,
> i.e. text align left and dropdownlist align right. I cannot add more cells
> to
> do format because it's in a Datagrid pager area. The html code generated
> for
> pager is one sigle cell with lots of colspan.
> I tried to add some html elements in between text and dropdownlist, for
> example table iframe and p but I cannot achieve the exact result.
> <td colspan="3" >1 2 3 4 5 6 <nobr><iframe width="70%" height="0"
> style="display:inline"></iframe>
> <select>
> <option selected="selected" value="10">10</option>
> <option value="25">25</option>
> <option value="50">50</option>
> </select></nobr></td>
> Any help?
> BTW my last question about adding dropdownlist to pager works fine. Thanks
> the reply.

HTML Formatting in .NET 2.0

Hello all, ive been programming with ASP.NET since it came out, but am just
getting my feet with now with v.2.
Ive noticed something strange in the way my HTML tables get rendered with 2.
I use tables to layout my pages, doing three rows, a header, content and
footer. When i do this, i make the tables height=100%,
so the footer always shows up at the very bottom of the page.
With 2.0/2005 though, when it renders the pages, it doesnt actually render
at 100% height (even though the code is in the ViewSource of the page).
the table only goes as high as the content forces it, as if the height were
not set at all.
Ive traced it to this line put in by the designer:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
Is there a way to turn this off, so the designer doesnt put this line out,
so that my tables will render properly? I tried using the Insert Table
wizard, and specifying the height of 100% but it the same problem as
manually coding it.
Oh, also, it tells me the "align" attribute is obsolete on the table tag,
and i should use the newer construct, but it doesnt tell me what that is...
what is considered the "right" way to align a table in the center of the
page now?
Thanks in advance,
Arthur DentTools|Options|TextEditor|HTML|Validation
is where you can turn this off.
You should be aware, though, that the reason this is used is because XHTML
will eventually supercede HTML on the WWW. This is a good thing. HTML has
become increasingly complex and unpredictable across many browsers. The
formatting rules for it are not strict enough, and it is not easily
extensible. XML in general, and XHTML specifically, are much more extensible
than HTML. XML follows some very strict but simple formatting rules. For
example, elements can not overlap. Opening tags must always be followed by
closing tags. Attributes must always be quoted. These things will eventually
cause all browsers to render content in the same way. But some things you
are now doing may not work correctly in browsers in the future. Learning the
XHTML standard, or at least the transitional standard, will prevent a lot of
future headaches for you, though they may cause you a few in the short run
(learning them, that is).
XHTML relies on styles almost exclusively, rather than attributes. This is
also a good thing. Putting CSS styles into an external style sheet, or at
least in a style sheet in the <head> of the document separates the layout
presentation rules from the HTML objects themselves, which makes it much
easier to change the way your documents look. Inline attributes (and inline
CSS styles) "lock" the appearance into the structure of the object, making
it difficult to find, identify, and change the way the elements look and
behave. The use of external CSS style sheets also allows you to use the same
style sheet for many documents, which is also a very good thing.
Many attributes are already deprecated. The "height" attribute has not been
a part of the standard since at least HTML 3.2, and I'm not sure if it ever
was. The "width" attribute of a table has been recently deprecated. All of
this is heading towards the use of CSS for this type of thing.
So, I gave you the means to turn it off, and a few reasons not to. Now the
ball is in your court!
HTH,
Kevin Spencer
Microsoft MVP
.Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.
"Arthur Dent" <hitchhikersguideto-news@.yahoo.com> wrote in message
news:eL$qYYkBGHA.3984@.TK2MSFTNGP14.phx.gbl...
> Hello all, ive been programming with ASP.NET since it came out, but am
> just getting my feet with now with v.2.
> Ive noticed something strange in the way my HTML tables get rendered with
> 2.
> I use tables to layout my pages, doing three rows, a header, content and
> footer. When i do this, i make the tables height=100%,
> so the footer always shows up at the very bottom of the page.
> With 2.0/2005 though, when it renders the pages, it doesnt actually render
> at 100% height (even though the code is in the ViewSource of the page).
> the table only goes as high as the content forces it, as if the height
> were not set at all.
> Ive traced it to this line put in by the designer:
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> Is there a way to turn this off, so the designer doesnt put this line out,
> so that my tables will render properly? I tried using the Insert Table
> wizard, and specifying the height of 100% but it the same problem as
> manually coding it.
> Oh, also, it tells me the "align" attribute is obsolete on the table tag,
> and i should use the newer construct, but it doesnt tell me what that
> is... what is considered the "right" way to align a table in the center of
> the page now?
> Thanks in advance,
> Arthur Dent
>
Okay, i understand all that, and it makes sense. And given that i would
agree it would be
better to find the "new & improved" way of styling my tags as opposed to
turning off the
validation tag.
I still have some questions then though about the specific styles of HEIGHT
and ALIGN.
HEIGHT does not seem to do anything even when i put it in the style of the
object instead
of as its own attribute. My footer (which i want to always be at the bottom
of the page)
winds up scrunched as close to the top of the page as possible (base on
current cotent of
the table). So how do i tell the new XHTML that i want my table to stretch
itself to the full
height of the document?
Also, what is the proper way to align the table in the center of the page. I
personally cannot
stand when a web page hangs off to the left side of the screen, so i would
always put on my
main table an ALIGN=CENTER, so that it would be in the middle of the page.
But this is
gawked at by the IDE, and i tried doing an ALIGN: CENTER in the style
instead but it had
no effect.
Also, does it _functionaly_ make a difference whether the style definition
is in a CSS vs.
a STYLE tag in the document vs. a STYLE attribute on the element?
Thanks in advance,
- Arthur Dent.
"Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
news:eTg$VWlBGHA.1312@.TK2MSFTNGP09.phx.gbl...
> Tools|Options|TextEditor|HTML|Validation
is where you can turn this off.
> You should be aware, though, that the reason this is used is because XHTML
> will eventually supercede HTML on the WWW. This is a good thing. HTML has
> become increasingly complex and unpredictable across many browsers. The
> formatting rules for it are not strict enough, and it is not easily
> extensible. XML in general, and XHTML specifically, are much more
> extensible than HTML. XML follows some very strict but simple formatting
> rules. For example, elements can not overlap. Opening tags must always be
> followed by closing tags. Attributes must always be quoted. These things
> will eventually cause all browsers to render content in the same way. But
> some things you are now doing may not work correctly in browsers in the
> future. Learning the XHTML standard, or at least the transitional
> standard, will prevent a lot of future headaches for you, though they may
> cause you a few in the short run (learning them, that is).
> XHTML relies on styles almost exclusively, rather than attributes. This is
> also a good thing. Putting CSS styles into an external style sheet, or at
> least in a style sheet in the <head> of the document separates the layout
> presentation rules from the HTML objects themselves, which makes it much
> easier to change the way your documents look. Inline attributes (and
> inline CSS styles) "lock" the appearance into the structure of the object,
> making it difficult to find, identify, and change the way the elements
> look and behave. The use of external CSS style sheets also allows you to
> use the same style sheet for many documents, which is also a very good
> thing.
> Many attributes are already deprecated. The "height" attribute has not
> been a part of the standard since at least HTML 3.2, and I'm not sure if
> it ever was. The "width" attribute of a table has been recently
> deprecated. All of this is heading towards the use of CSS for this type of
> thing.
> So, I gave you the means to turn it off, and a few reasons not to. Now the
> ball is in your court!
> --
> HTH,
> Kevin Spencer
> Microsoft MVP
> .Net Developer
> You can lead a fish to a bicycle,
> but it takes a very long time,
> and the bicycle has to *want* to change.
> "Arthur Dent" <hitchhikersguideto-news@.yahoo.com> wrote in message
> news:eL$qYYkBGHA.3984@.TK2MSFTNGP14.phx.gbl...
>
Hi Arthur,
As to height, you can use the CSS height style, which can be one of 2
alternative types:
nnnPX;
nnn%;
For center alignment, it's a little less intuitive. You use both margin-left
and margin-right, as in:
margin-left:auto;
margin-right:auto;

> Also, does it _functionaly_ make a difference whether the style definition
> is in a CSS vs.
> a STYLE tag in the document vs. a STYLE attribute on the element?
Not functionally, no. However, here are the advantages of each:
inline: None. Almost as bad as attributes.
document style sheet: Styles may be used throughout the document. Less text,
less redundancy, less points for you to make a mistake and forget or omit
something. Easier to change the style of the document, as the style sheet is
easy to find.
external style sheet: All the advantages of a document style sheet, but you
can also use the same styles for multiple pages.
HTH,
Kevin Spencer
Microsoft MVP
.Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.
"Arthur Dent" <hitchhikersguideto-news@.yahoo.com> wrote in message
news:OT0HWclBGHA.3408@.TK2MSFTNGP12.phx.gbl...
> Okay, i understand all that, and it makes sense. And given that i would
> agree it would be
> better to find the "new & improved" way of styling my tags as opposed to
> turning off the
> validation tag.
> I still have some questions then though about the specific styles of
> HEIGHT and ALIGN.
> HEIGHT does not seem to do anything even when i put it in the style of the
> object instead
> of as its own attribute. My footer (which i want to always be at the
> bottom of the page)
> winds up scrunched as close to the top of the page as possible (base on
> current cotent of
> the table). So how do i tell the new XHTML that i want my table to stretch
> itself to the full
> height of the document?
> Also, what is the proper way to align the table in the center of the page.
> I personally cannot
> stand when a web page hangs off to the left side of the screen, so i would
> always put on my
> main table an ALIGN=CENTER, so that it would be in the middle of the page.
> But this is
> gawked at by the IDE, and i tried doing an ALIGN: CENTER in the style
> instead but it had
> no effect.
> Also, does it _functionaly_ make a difference whether the style definition
> is in a CSS vs.
> a STYLE tag in the document vs. a STYLE attribute on the element?
> Thanks in advance,
> - Arthur Dent.
>
> "Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
> news:eTg$VWlBGHA.1312@.TK2MSFTNGP09.phx.gbl...
>
Thanks for the info... that center alignment DEFinitely, like you said, is
not intuitive. But it did
work perfectly.
I still cannot get the height to work properly though. With the validation
line in the HTML source,
the rendering completely ignores the HEIGHT specification on my table,
whether i do it as a style
attribute, a document style tag, or through a css class. But if i take out
the validation line, then the
height renders completely perfectly as expected.
The problem then though is, if i take out that validation like, then the
margin-[left|right]:auto to do
center alignment no longer works.
How do you get the HEIGHT of a table set at 100% to *actually* render as
100% height in the
new XHTML world?
Thanks in advance,
- Arthur Dent.
"Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
news:%23XEbvPmBGHA.2476@.TK2MSFTNGP10.phx.gbl...
> Hi Arthur,
> As to height, you can use the CSS height style, which can be one of 2
> alternative types:
> nnnPX;
> nnn%;
> For center alignment, it's a little less intuitive. You use both
> margin-left and margin-right, as in:
> margin-left:auto;
> margin-right:auto;
>
> Not functionally, no. However, here are the advantages of each:
> inline: None. Almost as bad as attributes.
> document style sheet: Styles may be used throughout the document. Less
> text, less redundancy, less points for you to make a mistake and forget or
> omit something. Easier to change the style of the document, as the style
> sheet is easy to find.
> external style sheet: All the advantages of a document style sheet, but
> you can also use the same styles for multiple pages.
> --
> HTH,
> Kevin Spencer
> Microsoft MVP
> .Net Developer
> You can lead a fish to a bicycle,
> but it takes a very long time,
> and the bicycle has to *want* to change.
> "Arthur Dent" <hitchhikersguideto-news@.yahoo.com> wrote in message
> news:OT0HWclBGHA.3408@.TK2MSFTNGP12.phx.gbl...
>

HTML Formatting in .NET 2.0

Hello all, ive been programming with ASP.NET since it came out, but am just
getting my feet with now with v.2.
Ive noticed something strange in the way my HTML tables get rendered with 2.

I use tables to layout my pages, doing three rows, a header, content and
footer. When i do this, i make the tables height=100%,
so the footer always shows up at the very bottom of the page.

With 2.0/2005 though, when it renders the pages, it doesnt actually render
at 100% height (even though the code is in the ViewSource of the page).
the table only goes as high as the content forces it, as if the height were
not set at all.

Ive traced it to this line put in by the designer:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
Is there a way to turn this off, so the designer doesnt put this line out,
so that my tables will render properly? I tried using the Insert Table
wizard, and specifying the height of 100% but it the same problem as
manually coding it.

Oh, also, it tells me the "align" attribute is obsolete on the table tag,
and i should use the newer construct, but it doesnt tell me what that is...
what is considered the "right" way to align a table in the center of the
page now?

Thanks in advance,
Arthur DentTools|Options|TextEditor|HTML|Validation is where you can turn this off.

You should be aware, though, that the reason this is used is because XHTML
will eventually supercede HTML on the WWW. This is a good thing. HTML has
become increasingly complex and unpredictable across many browsers. The
formatting rules for it are not strict enough, and it is not easily
extensible. XML in general, and XHTML specifically, are much more extensible
than HTML. XML follows some very strict but simple formatting rules. For
example, elements can not overlap. Opening tags must always be followed by
closing tags. Attributes must always be quoted. These things will eventually
cause all browsers to render content in the same way. But some things you
are now doing may not work correctly in browsers in the future. Learning the
XHTML standard, or at least the transitional standard, will prevent a lot of
future headaches for you, though they may cause you a few in the short run
(learning them, that is).

XHTML relies on styles almost exclusively, rather than attributes. This is
also a good thing. Putting CSS styles into an external style sheet, or at
least in a style sheet in the <head> of the document separates the layout
presentation rules from the HTML objects themselves, which makes it much
easier to change the way your documents look. Inline attributes (and inline
CSS styles) "lock" the appearance into the structure of the object, making
it difficult to find, identify, and change the way the elements look and
behave. The use of external CSS style sheets also allows you to use the same
style sheet for many documents, which is also a very good thing.

Many attributes are already deprecated. The "height" attribute has not been
a part of the standard since at least HTML 3.2, and I'm not sure if it ever
was. The "width" attribute of a table has been recently deprecated. All of
this is heading towards the use of CSS for this type of thing.

So, I gave you the means to turn it off, and a few reasons not to. Now the
ball is in your court!

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.

"Arthur Dent" <hitchhikersguideto-news@.yahoo.com> wrote in message
news:eL$qYYkBGHA.3984@.TK2MSFTNGP14.phx.gbl...
> Hello all, ive been programming with ASP.NET since it came out, but am
> just getting my feet with now with v.2.
> Ive noticed something strange in the way my HTML tables get rendered with
> 2.
> I use tables to layout my pages, doing three rows, a header, content and
> footer. When i do this, i make the tables height=100%,
> so the footer always shows up at the very bottom of the page.
> With 2.0/2005 though, when it renders the pages, it doesnt actually render
> at 100% height (even though the code is in the ViewSource of the page).
> the table only goes as high as the content forces it, as if the height
> were not set at all.
> Ive traced it to this line put in by the designer:
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> Is there a way to turn this off, so the designer doesnt put this line out,
> so that my tables will render properly? I tried using the Insert Table
> wizard, and specifying the height of 100% but it the same problem as
> manually coding it.
> Oh, also, it tells me the "align" attribute is obsolete on the table tag,
> and i should use the newer construct, but it doesnt tell me what that
> is... what is considered the "right" way to align a table in the center of
> the page now?
> Thanks in advance,
> Arthur Dent
Okay, i understand all that, and it makes sense. And given that i would
agree it would be
better to find the "new & improved" way of styling my tags as opposed to
turning off the
validation tag.
I still have some questions then though about the specific styles of HEIGHT
and ALIGN.

HEIGHT does not seem to do anything even when i put it in the style of the
object instead
of as its own attribute. My footer (which i want to always be at the bottom
of the page)
winds up scrunched as close to the top of the page as possible (base on
current cotent of
the table). So how do i tell the new XHTML that i want my table to stretch
itself to the full
height of the document?

Also, what is the proper way to align the table in the center of the page. I
personally cannot
stand when a web page hangs off to the left side of the screen, so i would
always put on my
main table an ALIGN=CENTER, so that it would be in the middle of the page.
But this is
gawked at by the IDE, and i tried doing an ALIGN: CENTER in the style
instead but it had
no effect.

Also, does it _functionaly_ make a difference whether the style definition
is in a CSS vs.
a STYLE tag in the document vs. a STYLE attribute on the element?

Thanks in advance,
- Arthur Dent.

"Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
news:eTg$VWlBGHA.1312@.TK2MSFTNGP09.phx.gbl...
> Tools|Options|TextEditor|HTML|Validation is where you can turn this off.
> You should be aware, though, that the reason this is used is because XHTML
> will eventually supercede HTML on the WWW. This is a good thing. HTML has
> become increasingly complex and unpredictable across many browsers. The
> formatting rules for it are not strict enough, and it is not easily
> extensible. XML in general, and XHTML specifically, are much more
> extensible than HTML. XML follows some very strict but simple formatting
> rules. For example, elements can not overlap. Opening tags must always be
> followed by closing tags. Attributes must always be quoted. These things
> will eventually cause all browsers to render content in the same way. But
> some things you are now doing may not work correctly in browsers in the
> future. Learning the XHTML standard, or at least the transitional
> standard, will prevent a lot of future headaches for you, though they may
> cause you a few in the short run (learning them, that is).
> XHTML relies on styles almost exclusively, rather than attributes. This is
> also a good thing. Putting CSS styles into an external style sheet, or at
> least in a style sheet in the <head> of the document separates the layout
> presentation rules from the HTML objects themselves, which makes it much
> easier to change the way your documents look. Inline attributes (and
> inline CSS styles) "lock" the appearance into the structure of the object,
> making it difficult to find, identify, and change the way the elements
> look and behave. The use of external CSS style sheets also allows you to
> use the same style sheet for many documents, which is also a very good
> thing.
> Many attributes are already deprecated. The "height" attribute has not
> been a part of the standard since at least HTML 3.2, and I'm not sure if
> it ever was. The "width" attribute of a table has been recently
> deprecated. All of this is heading towards the use of CSS for this type of
> thing.
> So, I gave you the means to turn it off, and a few reasons not to. Now the
> ball is in your court!
> --
> HTH,
> Kevin Spencer
> Microsoft MVP
> .Net Developer
> You can lead a fish to a bicycle,
> but it takes a very long time,
> and the bicycle has to *want* to change.
> "Arthur Dent" <hitchhikersguideto-news@.yahoo.com> wrote in message
> news:eL$qYYkBGHA.3984@.TK2MSFTNGP14.phx.gbl...
>> Hello all, ive been programming with ASP.NET since it came out, but am
>> just getting my feet with now with v.2.
>> Ive noticed something strange in the way my HTML tables get rendered with
>> 2.
>>
>> I use tables to layout my pages, doing three rows, a header, content and
>> footer. When i do this, i make the tables height=100%,
>> so the footer always shows up at the very bottom of the page.
>>
>> With 2.0/2005 though, when it renders the pages, it doesnt actually
>> render at 100% height (even though the code is in the ViewSource of the
>> page).
>> the table only goes as high as the content forces it, as if the height
>> were not set at all.
>>
>> Ive traced it to this line put in by the designer:
>>
>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>>
>> Is there a way to turn this off, so the designer doesnt put this line
>> out, so that my tables will render properly? I tried using the Insert
>> Table wizard, and specifying the height of 100% but it the same problem
>> as manually coding it.
>>
>> Oh, also, it tells me the "align" attribute is obsolete on the table tag,
>> and i should use the newer construct, but it doesnt tell me what that
>> is... what is considered the "right" way to align a table in the center
>> of the page now?
>>
>> Thanks in advance,
>> Arthur Dent
>>
Hi Arthur,

As to height, you can use the CSS height style, which can be one of 2
alternative types:

nnnPX;
nnn%;

For center alignment, it's a little less intuitive. You use both margin-left
and margin-right, as in:

margin-left:auto;
margin-right:auto;

> Also, does it _functionaly_ make a difference whether the style definition
> is in a CSS vs.
> a STYLE tag in the document vs. a STYLE attribute on the element?

Not functionally, no. However, here are the advantages of each:

inline: None. Almost as bad as attributes.
document style sheet: Styles may be used throughout the document. Less text,
less redundancy, less points for you to make a mistake and forget or omit
something. Easier to change the style of the document, as the style sheet is
easy to find.
external style sheet: All the advantages of a document style sheet, but you
can also use the same styles for multiple pages.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
You can lead a fish to a bicycle,
but it takes a very long time,
and the bicycle has to *want* to change.

"Arthur Dent" <hitchhikersguideto-news@.yahoo.com> wrote in message
news:OT0HWclBGHA.3408@.TK2MSFTNGP12.phx.gbl...
> Okay, i understand all that, and it makes sense. And given that i would
> agree it would be
> better to find the "new & improved" way of styling my tags as opposed to
> turning off the
> validation tag.
> I still have some questions then though about the specific styles of
> HEIGHT and ALIGN.
> HEIGHT does not seem to do anything even when i put it in the style of the
> object instead
> of as its own attribute. My footer (which i want to always be at the
> bottom of the page)
> winds up scrunched as close to the top of the page as possible (base on
> current cotent of
> the table). So how do i tell the new XHTML that i want my table to stretch
> itself to the full
> height of the document?
> Also, what is the proper way to align the table in the center of the page.
> I personally cannot
> stand when a web page hangs off to the left side of the screen, so i would
> always put on my
> main table an ALIGN=CENTER, so that it would be in the middle of the page.
> But this is
> gawked at by the IDE, and i tried doing an ALIGN: CENTER in the style
> instead but it had
> no effect.
> Also, does it _functionaly_ make a difference whether the style definition
> is in a CSS vs.
> a STYLE tag in the document vs. a STYLE attribute on the element?
> Thanks in advance,
> - Arthur Dent.
>
> "Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
> news:eTg$VWlBGHA.1312@.TK2MSFTNGP09.phx.gbl...
>> Tools|Options|TextEditor|HTML|Validation is where you can turn this off.
>>
>> You should be aware, though, that the reason this is used is because
>> XHTML will eventually supercede HTML on the WWW. This is a good thing.
>> HTML has become increasingly complex and unpredictable across many
>> browsers. The formatting rules for it are not strict enough, and it is
>> not easily extensible. XML in general, and XHTML specifically, are much
>> more extensible than HTML. XML follows some very strict but simple
>> formatting rules. For example, elements can not overlap. Opening tags
>> must always be followed by closing tags. Attributes must always be
>> quoted. These things will eventually cause all browsers to render content
>> in the same way. But some things you are now doing may not work correctly
>> in browsers in the future. Learning the XHTML standard, or at least the
>> transitional standard, will prevent a lot of future headaches for you,
>> though they may cause you a few in the short run (learning them, that
>> is).
>>
>> XHTML relies on styles almost exclusively, rather than attributes. This
>> is also a good thing. Putting CSS styles into an external style sheet, or
>> at least in a style sheet in the <head> of the document separates the
>> layout presentation rules from the HTML objects themselves, which makes
>> it much easier to change the way your documents look. Inline attributes
>> (and inline CSS styles) "lock" the appearance into the structure of the
>> object, making it difficult to find, identify, and change the way the
>> elements look and behave. The use of external CSS style sheets also
>> allows you to use the same style sheet for many documents, which is also
>> a very good thing.
>>
>> Many attributes are already deprecated. The "height" attribute has not
>> been a part of the standard since at least HTML 3.2, and I'm not sure if
>> it ever was. The "width" attribute of a table has been recently
>> deprecated. All of this is heading towards the use of CSS for this type
>> of thing.
>>
>> So, I gave you the means to turn it off, and a few reasons not to. Now
>> the ball is in your court!
>>
>> --
>> HTH,
>>
>> Kevin Spencer
>> Microsoft MVP
>> .Net Developer
>> You can lead a fish to a bicycle,
>> but it takes a very long time,
>> and the bicycle has to *want* to change.
>>
>> "Arthur Dent" <hitchhikersguideto-news@.yahoo.com> wrote in message
>> news:eL$qYYkBGHA.3984@.TK2MSFTNGP14.phx.gbl...
>>> Hello all, ive been programming with ASP.NET since it came out, but am
>>> just getting my feet with now with v.2.
>>> Ive noticed something strange in the way my HTML tables get rendered
>>> with 2.
>>>
>>> I use tables to layout my pages, doing three rows, a header, content and
>>> footer. When i do this, i make the tables height=100%,
>>> so the footer always shows up at the very bottom of the page.
>>>
>>> With 2.0/2005 though, when it renders the pages, it doesnt actually
>>> render at 100% height (even though the code is in the ViewSource of the
>>> page).
>>> the table only goes as high as the content forces it, as if the height
>>> were not set at all.
>>>
>>> Ive traced it to this line put in by the designer:
>>>
>>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>>>
>>> Is there a way to turn this off, so the designer doesnt put this line
>>> out, so that my tables will render properly? I tried using the Insert
>>> Table wizard, and specifying the height of 100% but it the same problem
>>> as manually coding it.
>>>
>>> Oh, also, it tells me the "align" attribute is obsolete on the table
>>> tag, and i should use the newer construct, but it doesnt tell me what
>>> that is... what is considered the "right" way to align a table in the
>>> center of the page now?
>>>
>>> Thanks in advance,
>>> Arthur Dent
>>>
>>
>>
Thanks for the info... that center alignment DEFinitely, like you said, is
not intuitive. But it did
work perfectly.

I still cannot get the height to work properly though. With the validation
line in the HTML source,
the rendering completely ignores the HEIGHT specification on my table,
whether i do it as a style
attribute, a document style tag, or through a css class. But if i take out
the validation line, then the
height renders completely perfectly as expected.
The problem then though is, if i take out that validation like, then the
margin-[left|right]:auto to do
center alignment no longer works.

How do you get the HEIGHT of a table set at 100% to *actually* render as
100% height in the
new XHTML world?

Thanks in advance,
- Arthur Dent.

"Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
news:%23XEbvPmBGHA.2476@.TK2MSFTNGP10.phx.gbl...
> Hi Arthur,
> As to height, you can use the CSS height style, which can be one of 2
> alternative types:
> nnnPX;
> nnn%;
> For center alignment, it's a little less intuitive. You use both
> margin-left and margin-right, as in:
> margin-left:auto;
> margin-right:auto;
>> Also, does it _functionaly_ make a difference whether the style
>> definition is in a CSS vs.
>> a STYLE tag in the document vs. a STYLE attribute on the element?
> Not functionally, no. However, here are the advantages of each:
> inline: None. Almost as bad as attributes.
> document style sheet: Styles may be used throughout the document. Less
> text, less redundancy, less points for you to make a mistake and forget or
> omit something. Easier to change the style of the document, as the style
> sheet is easy to find.
> external style sheet: All the advantages of a document style sheet, but
> you can also use the same styles for multiple pages.
> --
> HTH,
> Kevin Spencer
> Microsoft MVP
> .Net Developer
> You can lead a fish to a bicycle,
> but it takes a very long time,
> and the bicycle has to *want* to change.
> "Arthur Dent" <hitchhikersguideto-news@.yahoo.com> wrote in message
> news:OT0HWclBGHA.3408@.TK2MSFTNGP12.phx.gbl...
>> Okay, i understand all that, and it makes sense. And given that i would
>> agree it would be
>> better to find the "new & improved" way of styling my tags as opposed to
>> turning off the
>> validation tag.
>> I still have some questions then though about the specific styles of
>> HEIGHT and ALIGN.
>>
>> HEIGHT does not seem to do anything even when i put it in the style of
>> the object instead
>> of as its own attribute. My footer (which i want to always be at the
>> bottom of the page)
>> winds up scrunched as close to the top of the page as possible (base on
>> current cotent of
>> the table). So how do i tell the new XHTML that i want my table to
>> stretch itself to the full
>> height of the document?
>>
>> Also, what is the proper way to align the table in the center of the
>> page. I personally cannot
>> stand when a web page hangs off to the left side of the screen, so i
>> would always put on my
>> main table an ALIGN=CENTER, so that it would be in the middle of the
>> page. But this is
>> gawked at by the IDE, and i tried doing an ALIGN: CENTER in the style
>> instead but it had
>> no effect.
>>
>> Also, does it _functionaly_ make a difference whether the style
>> definition is in a CSS vs.
>> a STYLE tag in the document vs. a STYLE attribute on the element?
>>
>> Thanks in advance,
>> - Arthur Dent.
>>
>>
>> "Kevin Spencer" <kevin@.DIESPAMMERSDIEtakempis.com> wrote in message
>> news:eTg$VWlBGHA.1312@.TK2MSFTNGP09.phx.gbl...
>>> Tools|Options|TextEditor|HTML|Validation is where you can turn this off.
>>>
>>> You should be aware, though, that the reason this is used is because
>>> XHTML will eventually supercede HTML on the WWW. This is a good thing.
>>> HTML has become increasingly complex and unpredictable across many
>>> browsers. The formatting rules for it are not strict enough, and it is
>>> not easily extensible. XML in general, and XHTML specifically, are much
>>> more extensible than HTML. XML follows some very strict but simple
>>> formatting rules. For example, elements can not overlap. Opening tags
>>> must always be followed by closing tags. Attributes must always be
>>> quoted. These things will eventually cause all browsers to render
>>> content in the same way. But some things you are now doing may not work
>>> correctly in browsers in the future. Learning the XHTML standard, or at
>>> least the transitional standard, will prevent a lot of future headaches
>>> for you, though they may cause you a few in the short run (learning
>>> them, that is).
>>>
>>> XHTML relies on styles almost exclusively, rather than attributes. This
>>> is also a good thing. Putting CSS styles into an external style sheet,
>>> or at least in a style sheet in the <head> of the document separates the
>>> layout presentation rules from the HTML objects themselves, which makes
>>> it much easier to change the way your documents look. Inline attributes
>>> (and inline CSS styles) "lock" the appearance into the structure of the
>>> object, making it difficult to find, identify, and change the way the
>>> elements look and behave. The use of external CSS style sheets also
>>> allows you to use the same style sheet for many documents, which is also
>>> a very good thing.
>>>
>>> Many attributes are already deprecated. The "height" attribute has not
>>> been a part of the standard since at least HTML 3.2, and I'm not sure if
>>> it ever was. The "width" attribute of a table has been recently
>>> deprecated. All of this is heading towards the use of CSS for this type
>>> of thing.
>>>
>>> So, I gave you the means to turn it off, and a few reasons not to. Now
>>> the ball is in your court!
>>>
>>> --
>>> HTH,
>>>
>>> Kevin Spencer
>>> Microsoft MVP
>>> .Net Developer
>>> You can lead a fish to a bicycle,
>>> but it takes a very long time,
>>> and the bicycle has to *want* to change.
>>>
>>> "Arthur Dent" <hitchhikersguideto-news@.yahoo.com> wrote in message
>>> news:eL$qYYkBGHA.3984@.TK2MSFTNGP14.phx.gbl...
>>>> Hello all, ive been programming with ASP.NET since it came out, but am
>>>> just getting my feet with now with v.2.
>>>> Ive noticed something strange in the way my HTML tables get rendered
>>>> with 2.
>>>>
>>>> I use tables to layout my pages, doing three rows, a header, content
>>>> and footer. When i do this, i make the tables height=100%,
>>>> so the footer always shows up at the very bottom of the page.
>>>>
>>>> With 2.0/2005 though, when it renders the pages, it doesnt actually
>>>> render at 100% height (even though the code is in the ViewSource of the
>>>> page).
>>>> the table only goes as high as the content forces it, as if the height
>>>> were not set at all.
>>>>
>>>> Ive traced it to this line put in by the designer:
>>>>
>>>> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>>>> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
>>>>
>>>> Is there a way to turn this off, so the designer doesnt put this line
>>>> out, so that my tables will render properly? I tried using the Insert
>>>> Table wizard, and specifying the height of 100% but it the same problem
>>>> as manually coding it.
>>>>
>>>> Oh, also, it tells me the "align" attribute is obsolete on the table
>>>> tag, and i should use the newer construct, but it doesnt tell me what
>>>> that is... what is considered the "right" way to align a table in the
>>>> center of the page now?
>>>>
>>>> Thanks in advance,
>>>> Arthur Dent
>>>>
>>>
>>>
>>
>>

Monday, March 26, 2012

HTML formatting from VB.NET

I have a line in my VB.NET codebehind file that populates a textbox when loaded:

tbEmailContent.Text = record.job_number & "<br>" & record.completed_by & "<br>" & record.ssigned_to


The problem is that it actually shows <br> and does not use differerent lines.


Please advise how I can get the various record parts to show on different lines.

Cheers

John

Textbox control doesnt use HTML

1) set the Textbox control to MultiLine
2) for a linebreak use VbCrLf instead of "<br>"...text & VbCrLf & moretext & VbCrLf...

That should do it.

html formating, just like the box used to post messages on this forum?

I want to use the exact same "box" that I'm using when I'm writing this, to easily enable some text formatting functions for an app.

The bold, Italic and underscore formatting is what I'm after. I see on this forum it's done through javascript. Not being alergic to javascript, or any other suggestions I'll lean back and wait for answers.

Cheers!

/Eskil

Here are a few options:

freetextbox:http://freetextbox.com/default.aspx
fckeditor:http://www.fckeditor.net/
tinymce:http://tinymce.moxiecode.com/


This site has been using TinyMCE.

Thursday, March 22, 2012

HTML Code formatting

I have a web form that whenever I open it, Visual Studio (both 2003 and
2005) insist on reformatting it.
Is there a way to keep it from doing this?
Mainly what is happening, is a table I have on that page keeps
automatically adjusting its width and height where I do not want it to.
BCThis is a problem with the page parser due to the fact that the html on your
page is bad. You have an issue like overlapping tags or inappropriate tag
placement or something difficult to see like that. It is easy to do with thi
s
with repeaters where you have the repeater repeat a table row by putting it
inbetween the <table> and <tr> tags.
check your mark up first, if the page is big, try cutting out large chuncks
and check if it still happens. keeps trying as there is likely to be an issu
e
somewhere. If you cant find it then post your markup.
Ciaran O''''Donnell
http://wannabedeveloper.spaces.live.com
"Blasting Cap" wrote:

> I have a web form that whenever I open it, Visual Studio (both 2003 and
> 2005) insist on reformatting it.
> Is there a way to keep it from doing this?
> Mainly what is happening, is a table I have on that page keeps
> automatically adjusting its width and height where I do not want it to.
>
> BC
>
Hi, is this an answer on my post?
"Blasting Cap" <goober@.christian.net> schreef in bericht
news:evIlfzEJHHA.4068@.TK2MSFTNGP03.phx.gbl...
>I have a web form that whenever I open it, Visual Studio (both 2003 and
>2005) insist on reformatting it.
> Is there a way to keep it from doing this?
> Mainly what is happening, is a table I have on that page keeps
> automatically adjusting its width and height where I do not want it to.
>
> BC
>
What are you asking here?
Ciaran answered you over an hour before your last post.
David Wier
MVP/ASPInsider
http://aspnet101.com
http://aspexpress.com
"Bob" <gtdbd> wrote in message news:OAMvZpFJHHA.420@.TK2MSFTNGP06.phx.gbl...
> Hi, is this an answer on my post?
> "Blasting Cap" <goober@.christian.net> schreef in bericht
> news:evIlfzEJHHA.4068@.TK2MSFTNGP03.phx.gbl...
>