Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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?
Posted
Updated 5-Sep-11 5:00am
v2
Comments
LittleYellowBird 5-Sep-11 11:01am    
One question mark is sufficient, more just annoys people making it less likely that you will get a helpful answer, so I have edited your question to remove the extras. :)

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.
 
Share this answer
 
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>
 
Share this answer
 
Solution 1
i need The code Plz
 
Share this answer
 
<asp: id="ddlitem" runat="server" onselectedindexchanged="ddlitem_SelectedIndexChanged" autopostback="true" xmlns:asp="#unknown">


protected void ddlitem_SelectedIndexChanged(object sender, EventArgs e)
{
DropDownList ddl = sender as DropDownList;
DataGridItem row = (DataGridItem)DropDownList.NamingContainer;
{
= row.Cells[1].Text;
=((DropDownList)row.FindControl("DropDownList")).SelectedValue;
int Unit= Convert.ToInt32(strPrice)*Convert.ToInt32(strItem)
row.Cells[2].Text=Unit.Tostring();
}
 
Share this answer
 
Comments
alhlwany.it 12-Oct-11 6:10am    
Solution 4
Code is not complete
And another question


if I view the choice of dropdownlist "ItemName" On TextBox Outside the GridView
I want Form of a code


Thanxxxxx For Your Help Excuse me for my English

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900