ImageGear .NET v24.12 - Updated
insertDocument Method

ImageGear.Web.UI Library > ImageGear.Web.UI Namespace > ImGearDocumentCollection class : insertDocument Method
Inserts a document in the collection at the location specified by the parameter 'index'.
Syntax
ASP.NET Ajax Javascript (Specification) 
function insertDocument( 
   index : number(Integer),
   imGearDocument : ImGearDocument
) : (Any);
ASP.NET Ajax Javascript (Usage) 
var resultVar = instanceOfImGearDocumentCollection.insertDocument(number(Integer),ImGearDocument);

Parameters

index
A zero-based index in the document collection where the document is to be inserted.
imGearDocument
The document to be inserted in the collection.
Remarks

The function will insert the document at the location in the collection specified by the index parameter.

After this function has inserted the document to the collection, it will raise the documentAdded event.

Note: A document object instance must be unique in a ImGearThumbnailList control and a web page.

The index will be validated. The value must be a zero or greater than zero but less than or equal to the collection length (0<=index<=length). An exception is thrown for invalid values. The insertion index value must be within the collection's length range. If the collection is empty and insertion index specified is other than 0, an exception will be thrown. Negative values for the index are not acceptable. The insert action at index zero when the collection is empty is equivalent to addDocument action. The insertion occurs at the index specified, for example, insertDocument(0,newDocument) would insert the new document before the existing index 0.

Note: When inserting a new document to the collection, make sure that the new document does not contain a duplicated instance of a ImGearPage object in the document's page collection ImGearPageCollection, addPage property for details.

See Also

Reference

ImGearDocumentCollection class
ImGearDocumentCollection Members