DropDownList Insid GridView [英] DropDownList Insid GridView
本文介绍了DropDownList Insid GridView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只想问一下如何在gridview控件中获取下拉列表"ItemName"的selectedvalue.并将该值乘以价格"列上绑定的项目价格"上的值,然后将项目单位"放在单位"列上.我想在每次更改下拉列表的索引时触发此事件.顺便说一句,即时通讯使用C#.net 2.0和mssql 2005
我该怎么办?
I just want to ask on how will i going to get the selectedvalue of my dropdownlist "ItemName" inside a gridview control. And multiply that value on bound filed "itemPrice" on "Price" column and place the Item Unit on "Unit" column. I want to fire this event every time i change the index of the dropdownlist. by the way, Im using C#.net 2.0 and mssql 2005
How Can I Do That?
推荐答案
您的下拉列表必须在GridViewTemplate中,因此只需编写一个函数即可在当前行中找到控件,这样您就可以读取该dplist的值.
Hi,
Your dropdown list must be in GridViewTemplate, so just write a function where you find the control from current row and so you could be able to read the value of that dplist.
将下拉列表放入其中网格视图并在选定的索引更改事件中随意编写代码
< pre>
< asp:DropDownList ID ="ddlist1" runat ="server" OnSelectedIndexChanged ="ddlist1_SelectedIndexChanged"
AutoPostBack ="true"/>
受保护的void ddlist1_SelectedIndexChanged(object sender,EventArgs e)
{
您的代码
}
</pre>
place dropdown list inside grid view and write the code whatever u want in selected index changed event
<pre>
<asp:DropDownList ID="ddlist1" runat="server" OnSelectedIndexChanged="ddlist1_SelectedIndexChanged"
AutoPostBack="true" />
protected void ddlist1_SelectedIndexChanged(object sender, EventArgs e)
{
u r code
}
</pre>
解决方案1
我需要代码Plz
Solution 1
i need The code Plz
这篇关于DropDownList Insid GridView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文