dataFormatAs property
Specifies or returns how data is to be rendered.
This property is part of the Microsoft Tabular Data Control, so it can only be used by generated content.
Syntax:
You can find the related objects in the Supported by objects section below.
This property is read/write.
HTML page for this property: dataFormatAs |
Possible values:
String that sets or retrieves the type of the rendering.
One of the following values:
Rendered as HTML. | |||||||
Rendered as text with locale settings applied. | |||||||
Default. Rendered as text. |
Default: text.
Example HTML code 1:
This example uses the Microsoft Tabular Data Control to introduce the dataFormatAs attribute:
|
||||
<xml id="movies"> <?xml version="1.0"?> <movies> <movie> <name><b>Clark Kent</b></name> <jobtitle>Superman</jobtitle> <born>1966</born> </movie> <movie> <name><b>Lois Lane</b></name> <jobtitle>Reporter</jobtitle> <born>1964</born> </movie> </movies> </xml> <table width="100%" cellpadding="0px" cellspacing="2px" border="1px" datasrc="#movies" datapagesize="2" > <thead> <tr> <th>Name</th> <th>Jobtitle</th> <th>Born</th> </tr> </thead> <tbody> <tr> <td><span datafld="name" dataformatas="html"></span></td> <td><span datafld="jobtitle"></span></td> <td><span datafld="born"></span></td> </tr> </tbody> </table> |
||||
|
||||
Did you find this example helpful?
|
Example HTML code 2:
This example illustrates the use of the dataFormatAs property with XML data island:
|
||||
<head> <script type="text/javascript"> function ChangeRender (button) { var renderType; var dataTable = document.getElementById ("dataTable"); if ('dataSrc' in dataTable) { for (var i = 0; i < dataTable.tBodies.length; i++) { var cell = dataTable.tBodies[i].rows[0].cells[0]; var span = cell.getElementsByTagName ("span")[0]; renderType = span.dataFormatAs; span.dataFormatAs = (renderType == "html") ? "text" : "html"; } button.innerHTML = (renderType == "html")? "Render name column as text" : "Render name column as HTML"; } else { alert ("Your browser doesn't support this example!"); } } </script> </head> <body> <xml id="movies"> <?xml version="1.0"?> <movies> <movie> <name><b>Clark Kent</b></name> <jobtitle>Superman</jobtitle> <born>1966</born> </movie> <movie> <name><b>Lois Lane</b></name> <jobtitle>Reporter</jobtitle> <born>1964</born> </movie> </movies> </xml> <table id="dataTable" width="100%" cellpadding="0px" cellspacing="2px" border="1px" datasrc="#movies" datapagesize="2"> <thead> <tr> <th>Name</th> <th>Jobtitle</th> <th>Born</th> </tr> </thead> <tbody> <tr> <td><span datafld="name" dataformatas="html"></span></td> <td><span datafld="jobtitle"></span></td> <td><span datafld="born"></span></td> </tr> </tbody> </table> <br/> <button onclick="ChangeRender (this);">Render name column as text!</button> </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by objects:
Related pages:
dataFld
dataPageSize
dataSrc
firstPage
lastPage
nextPage
previousPage
recordNumber
oncellchange
ondataavailable
ondatasetchanged
ondatasetcomplete
dataPageSize
dataSrc
firstPage
lastPage
nextPage
previousPage
recordNumber
oncellchange
ondataavailable
ondatasetchanged
ondatasetcomplete
External links:
User Contributed Comments