NJX:NJXFILEDOWNLOAD

#### Search Results

Search

# NJX:NJXFILEDOWNLOAD

The NJX:NJXFILEDOWNLOAD control is used to add a link to your page layout for downloading files from the Natural server to the client.

To use the NJX:NJXFILEDOWNLOAD control, you must also add an NJX:OBJECTS control to your page layout.You can link to all files available in the NJX:OBJECTS cache. The link is directly passed to the browser. To force the browser to download a file instead of opening it, you append the parameter `DOWNLOAD=true` to your link (for example, "nat:mydoc?DOWNLOAD=true"). The `CONTENTID` of the file in the NJX:OBJECTS cache will be used as a suggestion for the name of the downloaded file. You can also refer to files outside of the NJX:OBJECTS cache by using a normal browser link. In this case, the `DOWNLOAD` parameter is not evaluated by the Natural for Ajax framework.

To trigger a download from another control (for example, from a BUTTON control), you have to use the SUBPAGE control instead. See the Natural for Ajax demos for an example.

The following topics are covered below:

- Example

- Adapter Interface

- Properties

Note
See also Documents in Some Common Rules for all Controls.

## Example

The XML layout definition is:

    <itr>
       <label name="Download Link" width="100">
       </label>
       <njx:njxfiledownload  valueprop="mydownload" >
       </njx:njxfiledownload>
    </itr>

When you choose the Download from Natural link in this example, the file download dialog from your operating system appears.

## Adapter Interface

    1 MYDOWNLOAD
    2 LINKPROP (A) DYNAMIC
    2 NAMEPROP (A) DYNAMIC

## Properties

Basic
width | Width of the control. There are three possibilities to define the width: (A) You do not define a width at all. In this case the width of the control will either be a default width or - in case of container controls - it will follow the width that is occupied by its content. (B) Pixel sizing: just input a number value (e.g. "100"). (C) Percentage sizing: input a percantage value (e.g. "50%"). Pay attention: percentage sizing will only bring up correct results if the parent element of the control properly defines a width this control can reference. If you specify this control to have a width of 50% then the parent element (e.g. an ITR-row) may itself define a width of "100%". If the parent element does not specify a width then the rendering result may not represent what you expect. | Optional | 100 120 140 160 180 200 50% 100%
height | Height of the control. There are three possibilities to define the height: (A) You do not define a height at all. As consequence the control will be rendered with its default height. If the control is a container control (containing) other controls then the height of the control will follow the height of its content. (B) Pixel sizing: just input a number value (e.g. "20"). (C) Percentage sizing: input a percentage value (e.g. "50%"). Pay attention: percentage sizing will only bring up correct results if the parent element of the control properly defines a height this control can reference. If you specify this control to have a height of 50% then the parent element (e.g. an ITR-row) may itself define a height of "100%". If the parent element does not specify a width then the rendering result may not represent what you expect. | Optional | 100 150 200 250 300 250 400 50% 100%
ihtmlstyle | CSS style definition that is directly passed into this control. With the style you can individually influence the rendering of the control. You can specify any style sheet expressions. Examples are: border: 1px solid #FF0000 background-color: #808080 You can combine expressions by appending and separating them with a semicolon. Sometimes it is useful to have a look into the generated HTML code in order to know where direct style definitions are applied. Press right mouse-button in your browser and select the "View source" or "View frame's source" function. | Optional | background-color: #FF0000 color: #0000FF font-weight: bold
comment | Comment without any effect on rendering and behaviour. The comment is shown in the layout editor's tree view. | Optional |

### On this page

- Example
- Adapter Interface
- Properties