04-21-2006, 07:32 PM
Im having an issue retrieving the value of a databound dropdownlist inside of a gridview. I thought maybe that i could get the value on the selelectedindexchange but still it does not work.
The dropdownlist contains a list of employees the datatextfield is their name and the value field is their employeeid. My goal is once the employee has been changed i want a text box ,3 columns over, to populate with the employee billing rate.
Thanks in advance
04-22-2006, 08:39 AM
OK go throug the url
hope it will help u
04-22-2006, 02:48 PM
Thanks for answering me
the url that you sent me to was unable to aid me in any way. I dont want to retrieve the uniqueid of the entire row however i do want to retirieve the uniquieid/employeeid of the selectedvalue in the dropdownlist which is a template column within the gridview.
04-22-2006, 07:03 PM
Does this article (http://www.4guysfromrolla.com/webtech/050801-1.shtml) help?
04-23-2006, 02:07 AM
well so far i have figured out that i can get the textbox to populate when i select an item in the dropdown. I have that part working now but the one problem still remains is when i try to add multiple rows in the gridview.
Heres my code:
protected void dropTech_SelectedIndexChanged(object sender, EventArgs e)
mpControl = (GridView)mpContentPlaceHolder.FindControl("gvLabor");
//int iRowID = mpControl.FindControl("lbl
//extract the employeeid for the employee that is selected
int iEmployeeID = Convert.ToInt32(((DropDownList)mpControl.Rows.Cells.Controls.FindControl("dropTech")).SelectedItem.Value);
//int iEmployeeID = Convert.ToInt32(((DropDownList)mpControl.Rows.Cells.Controls.FindControl("dropTech")).SelectedItem.Value);
//get that employee billing rate
DataSet dsBillingRate = new DataSet();
dsBillingRate = VMBO.instance.getEmployeeBillingRate(iEmployeeID);
foreach (DataRow drBillingRate in dsBillingRate.Tables.Rows)
dBillingRate = (Decimal)drBillingRate["BillingRate"];
//now make the textbox have that value
((TextBox)mpControl.Rows.Cells.Controls.FindControl("txtRate")).Text = Convert.ToString(dBillingRate);