我有以下中繼代碼:與用戶控件asp.net中繼器 - 設置commandargument
<asp:Repeater ID="repMain" runat="server" OnItemCommand="repMain_ItemCommand" EnableViewState="false">
<ItemTemplate>
<dmg:testcontrol runat="server" MyData=<%#Container.DataItem %>>
</dmg:testcontrol>
</ItemTemplate>
</asp:Repeater>
的用戶控件系統testControl看起來像:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="TestControl.ascx.cs" Inherits="TestRepeater.TestControl" %>
<asp:Literal runat="server" ID="litMain" Text="<%#MyData.MyValue %>"></asp:Literal>
<asp:DropDownList runat="server" ID="dropdownMain"></asp:DropDownList>
<asp:Button runat="server" ID="btnMain" Text="Click Me" CommandName="Update" CommandArgument="<%#dropdownMain.SelectedValue%>"/>
是否有可能對我來說,通過dropdownMain發送。 SelectedValue作爲CommandArgument?
剛纔它是一個空字符串。
感謝
鄧肯
PS這是關係到ASP.NET Repeater not binding after ItemCommand,但我認爲這兩個十分不同,保持分開。