当重复数据主义控件时,我如何获得每个asp按钮btnExplodedGroupCode
以及数据列表中的telerik radcomboBox的索引(注释)RadCmbExplodedGroupCodes
<asp:DataList ID="dlExplodedGroupCodes" runat="server" RepeatDirection="Horizontal"
RepeatColumns="1" CellSpacing="4" CellPadding="4">
<ItemTemplate>
<asp:Button ID="btnExplodedGroupCode" runat="server" CommandArgument='<%# Eval("ProcedureGroupId") %>'
Text='<%# Eval("MainGroup") %>' Width="75px" OnClientClick="return CheckToochSelection();"
OnClick="btnExplodedGroupCode_Click" CssClass="rg_button" />
<telerik:RadComboBox ID="RadCmbExplodedGroupCodes" runat="server" DataValueField="ProcedureID"
DataTextField="ProcedureName" HighlightTemplatedItems="true" AllowCustomText="false"
AutoPostBack="true" Skin="MyBlueSkin" EnableEmbeddedSkins="false" Height="200px"
Width="19px" DropDownWidth="298px" NoWrap="true" >
</telerik:RadComboBox>
</ItemTemplate>
</asp:DataList>
答案 0 :(得分:1)
请尝试使用以下代码段。
如果我不理解你的问题,请告诉我。
客户端:
JS
function CheckToochSelection(a) {
alert(a);
}
ASPX
<asp:Button ID="btnExplodedGroupCode" runat="server" CommandArgument='<%# Eval("Name") %>'
Text='<%# Eval("Name") %>' Width="75px" OnClientClick='<%# "return CheckToochSelection(" + Container.ItemIndex +");" %>'
CssClass="rg_button" OnClick="btnExplodedGroupCode_Click"/>
服务器端:
protected void btnExplodedGroupCode_Click(object sender, EventArgs e)
{
int index = ((sender as Button).NamingContainer as DataListItem).ItemIndex;
}