Asp.Net ListView 內的InsertItemTemplate 標籤修改
1 |
<span style="color: #606060" id="lnum1"> 1:</span> <span style="color: #0000ff"><</span><span style="color: #800000">InsertItemTemplate</span><span style="color: #0000ff">></span> |
1 |
<span style="color: #606060" id="lnum2"> 2:</span> <span style="color: #0000ff"><</span><span style="color: #800000">tr</span> <span style="color: #ff0000">style</span><span style="color: #0000ff">=""</span><span style="color: #0000ff">></span> |
1 |
<span style="color: #606060" id="lnum3"> 3:</span> <span style="color: #0000ff"><</span><span style="color: #800000">td</span><span style="color: #0000ff">></span> |
1 |
<span style="color: #606060" id="lnum4"> 4:</span> <span style="color: #0000ff"><</span><span style="color: #800000">asp:DropDownList</span> <span style="color: #ff0000">ID</span><span style="color: #0000ff">="ddl_depup"</span> <span style="color: #ff0000">runat</span><span style="color: #0000ff">="server"</span> |
1 |
<span style="color: #606060" id="lnum5"> 5:</span> <span style="color: #ff0000">DataSourceID</span><span style="color: #0000ff">="dep_up_list"</span> |
1 |
<span style="color: #606060" id="lnum6"> 6:</span> <span style="color: #ff0000">DataTextField</span><span style="color: #0000ff">="sys_dep_name"</span> |
1 |
<span style="color: #606060" id="lnum7"> 7:</span> <span style="color: #ff0000">DataValueField</span><span style="color: #0000ff">="sys_dep_id"</span> |
1 |
<span style="color: #606060" id="lnum8"> 8:</span> <span style="color: #ff0000">SelectedValue</span><span style="color: #0000ff">='<%# Bind("sys_dep_up") %>'</span><span style="color: #0000ff">/></span> |
1 |
<span style="color: #606060" id="lnum9"> 9:</span> <span style="color: #0000ff"></</span><span style="color: #800000">td</span><span style="color: #0000ff">></span> |
1 |
<span style="color: #606060" id="lnum10"> 10:</span> <span style="color: #0000ff"></</span><span style="color: #800000">InsertItemTemplate</span><span style="color: #0000ff">></span> |
C#後台語法 , 指定插入時動作
1 |
<span style="color: #606060" id="lnum1"> 1:</span> <span style="color: #0000ff">protected</span> <span style="color: #0000ff">void</span> ListView1_ItemInserting(<span style="color: #0000ff">object</span> sender, ListViewInsertEventArgs e) |
1 |
<span style="color: #606060" id="lnum2"> 2:</span> { |
1 |
<span style="color: #606060" id="lnum3"> 3:</span> DropDownList ddl_depup = (DropDownList)ListView1.InsertItem.FindControl(<span style="color: #006080">"ddl_depup"</span>); |
1 |
<span style="color: #606060" id="lnum4"> 4:</span> e.Values[<span style="color: #006080">"EmployeeID"</span>] = ddl_depup.SelectedValue; |
1 |
<span style="color: #606060" id="lnum5"> 5:</span> } |
(Visited 14 times, 1 visits today)