コード例 #1
0
        /// <summary>
        /// Generates hidden indexer input for model according to template info.
        /// </summary>
        /// <param name="helper">HtmlHelper.</param>
        /// <param name="htmlAttributes">Html attributes to attach to input.</param>
        /// <returns>Indexer input for model.</returns>
        public static MvcHtmlString HiddenIndexerForModel <TModel>(
            this HtmlHelper <TModel> helper,
            object htmlAttributes)
        {
            // Get collection name and index from template info
            TemplateInfo templateInfo    = helper.ViewData.TemplateInfo;
            string       collectionName  = templateInfo.GetCollectionName();
            string       collectionIndex = templateInfo.GetCollectionIndex();

            return(helper.HiddenIndexerForModel(
                       collectionName,
                       collectionIndex,
                       htmlAttributes));
        }