在Asp.net MVC 中,使得我們能夠更加自由控制我們所想顯示HTML。通常情況下,都要做一下數(shù)據(jù)列表。那么我們可以手動去拼一個表格出來,但這樣有時對于復(fù)雜的表格說,那就JS代碼比較復(fù)雜了。我們可以借助JS下的模板引擎,來實現(xiàn)這一功能。下面要介紹就是JTemplates,它也是基于Jquery的。
}
});
});
function ApplyTemplate(msg) {
$('#Container').setTemplate($("#TemplateResultsTable").html());
$('#Container').processTemplate(msg);
}
/script>
/head>
body>
div id="Container"> /div>
%-- Results Table Template --%>
script type="text/html" id="TemplateResultsTable">
{#template MAIN}
table cellpadding="10" cellspacing="0">
tr>
th>Username/th>
th>Password/th>
th>Url/th>
th>Email/th>
th>PassportID/th>
/tr>
{#foreach$Tasuu}
{#includeROWroot=$T.uu}
{#/for}
/table>
{#/templateMAIN}
{#templateROW}
trclass="{#cyclevalues=['','evenRow']}">
td>{$T.UserName.bold()}/td>
td>{$T.Password}/td>
td>{$T.Url.link($T.Url)}/td>
td>{$T.Email.link('mailto:'+$T.Email)}/td>
td>{$T.PassportID}/td>
/tr>
{#/templateROW}
/script>
/body>
/html>
標(biāo)簽:大興安嶺 曲靖 宜春 綿陽 延安 黃南 新疆 焦作
巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《asp.net使用jquery模板引擎jtemplates呈現(xiàn)表格》,本文關(guān)鍵詞 asp.net,使用,jquery,模板,引擎,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。