asp:itemtemplate中DropdoWnList联动label

<asp:repeater><ItemTemplate><tr><td><asp:DropDownListid="species"runat="server"AutoPo... <asp:repeater>
<ItemTemplate>
<tr>
<td>
<asp:DropDownList id="species" runat="server" AutoPostBack ="true" />
</td>
<td>
<asp:Label id="salesreal" runat="server" Text='<%# Eval("salesreal")%>' />
</td>
</tr>
</ItemTemplate>
</asp:repeater>
如何 dropdownlist 选择后 赋值 label 每行实现
展开
 我来答
eadio
2014-06-10 · TA获得超过1610个赞
知道小有建树答主
回答量:962
采纳率:80%
帮助的人:1017万
展开全部

<asp:DropDownList id="species" runat="server" AutoPostBack ="true" />使用它的默认触发事件,修改如下

<asp:DropDownList id="species" runat="server" AutoPostBack ="true" OnSelectedIndexChanged="changeText" />


函数:

   <script language="VB" runat="server">


      

       

       Sub changeText(ByVal Sender As Object, ByVal E As EventArgs)

           salesreal.Text = " you selected: " & species.SelectedItem.Text

       End Sub


   </script>


演示结果:

初始化


选中触发事件

更多追问追答
追问
这是 JS吗?  前台写吗?   Sub 写在前台 无法识别啊
追答
你这个不是.net的吗??怎么会无法识别呢??
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式