cannot bind the ddl in my editable gridview
-
I have a dropdownlist within my editable gridview.The datasource of the gridview is a datatable method which accepts as a parameter the text of the lable of one of the columns in the gridview.I'm using the code below to try this task but it is not working. protected void gvServices_DataBinding(object sender, GridViewRowEventArgs e) {//gvServices is a gridview name if (e.Row.RowType == DataControlRowType.DataRow) { DropDownList ddl = (DropDownList)e.Row.Cells[3].FindControl("DDLServType"); Label lbl = (Label)e.Row.Cells[2].FindControl("lblServiceName"); string servicename= lbl.Text; ddl.DataSource = st.getServiceTypes(servicename); ddl.DataBind(); } }
ML Lingwati
-
I have a dropdownlist within my editable gridview.The datasource of the gridview is a datatable method which accepts as a parameter the text of the lable of one of the columns in the gridview.I'm using the code below to try this task but it is not working. protected void gvServices_DataBinding(object sender, GridViewRowEventArgs e) {//gvServices is a gridview name if (e.Row.RowType == DataControlRowType.DataRow) { DropDownList ddl = (DropDownList)e.Row.Cells[3].FindControl("DDLServType"); Label lbl = (Label)e.Row.Cells[2].FindControl("lblServiceName"); string servicename= lbl.Text; ddl.DataSource = st.getServiceTypes(servicename); ddl.DataBind(); } }
ML Lingwati
Perhaps if you whip it harder, it will work more ? If you want more meaningful help, you have to tell us 1 - what 'not working' means 2 - if you're sure this code is being called 3 - what happens as you step through the code in the debugger.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
I have a dropdownlist within my editable gridview.The datasource of the gridview is a datatable method which accepts as a parameter the text of the lable of one of the columns in the gridview.I'm using the code below to try this task but it is not working. protected void gvServices_DataBinding(object sender, GridViewRowEventArgs e) {//gvServices is a gridview name if (e.Row.RowType == DataControlRowType.DataRow) { DropDownList ddl = (DropDownList)e.Row.Cells[3].FindControl("DDLServType"); Label lbl = (Label)e.Row.Cells[2].FindControl("lblServiceName"); string servicename= lbl.Text; ddl.DataSource = st.getServiceTypes(servicename); ddl.DataBind(); } }
ML Lingwati
use
onrowdatabound
event rather thanDataBinding
. Also let me know what error it produces ... :cool:Abhishek Sur
My Latest Articles **Create CLR objects in SQL Server 2005 C# Uncommon Keywords Read/Write Excel using OleDB
**Don't forget to click "Good Answer" if you like to.