|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Adding Dropdownlist to GridViewMy Chargecode table has ChargecodeID,c_Text I need an Editable datagrid that will show the TimeID,Employee,PayPeriod,C_Text in a label and hours, along with an edit linkbutton. When they click on edit, the edit button turns to Update Cancel TimeID stays read Only Employee stays read only PayPeriod stays read only C_Text turns into a dropdownlist so they can select the proper chargecode via a dropdownlist Hours is read/write What is the best way to do this? I would have thought I add a gridview, configure the datasource to the Time Table. Then, I go to the ChargecodeID field and ask for it to be converted to a templatefield. When i open the templatefield there is a label field in there. I delete it. I add a dropdownlist. I set its datasource to a source linked to the ChargeCode Table. I go to Choose datasource and select c_text as the field to display, ChargeCodeID as the value for the dropdown. Next I go to edit data bindings and for Selectedvalue I set field binding to ChargeCodeID When I try to open the page I get an error message 'DropDownList1' has a SelectedValue which is invalid because it does not exist in the list of items. Parameter name: value Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.ArgumentOutOfRangeException: 'DropDownList1' has a SelectedValue which is invalid because it does not exist in the list of items. Parameter name: value Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [ArgumentOutOfRangeException: 'DropDownList1' has a SelectedValue which is invalid because it does not exist in the list of items. Parameter name: value] System.Web.UI.WebControls.ListControl.PerformDataBinding(IEnumerable dataSource) +1777763 System.Web.UI.WebControls.ListControl.OnDataBinding(EventArgs e) +104 System.Web.UI.WebControls.ListControl.PerformSelect() +31 System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70 System.Web.UI.Control.DataBindChildren() +216 System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +216 System.Web.UI.Control.DataBind() +12 System.Web.UI.Control.DataBindChildren() +216 System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +216 System.Web.UI.Control.DataBind() +12 System.Web.UI.WebControls.GridView.CreateRow(Int32 rowIndex, Int32 dataSourceIndex, DataControlRowType rowType, DataControlRowState rowState, Boolean dataBind, Object dataItem, DataControlField[] fields, TableRowCollection rows, PagedDataSource pagedDataSource) +221 System.Web.UI.WebControls.GridView.CreateChildControls(IEnumerable dataSource, Boolean dataBinding) +3004 System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable data) +59 System.Web.UI.WebControls.GridView.PerformDataBinding(IEnumerable data) +11 System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable data) +111 System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +29 System.Web.UI.WebControls.DataBoundControl.PerformSelect() +149 System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70 System.Web.UI.WebControls.GridView.DataBind() +4 System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82 System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +69 System.Web.UI.Control.EnsureChildControls() +87 System.Web.UI.Control.PreRenderRecursiveInternal() +41 System.Web.UI.Control.PreRenderRecursiveInternal() +161 System.Web.UI.Control.PreRenderRecursiveInternal() +161 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360 Any help out there? Mitch,
I too am getting this same error.The odd thing is that I already have a DropDown in different column, same grid, and its working. I'm trying to add a 2nd Dropdown, but its not working. cannot figure out what the error is. Did you get your problem solved? If so can you share the solution? Thanks, rwiethorn mitchma***@yahoo.com wrote: Show quoteHide quote > My Time table has TimeID,Employee,PayPeriod,ChargeCodeID,Hours > My Chargecode table has ChargecodeID,c_Text > > I need an Editable datagrid that will show the > TimeID,Employee,PayPeriod,C_Text in a label and hours, along with an > edit linkbutton. > > When they click on edit, the edit button turns to Update Cancel > > TimeID stays read Only > Employee stays read only > PayPeriod stays read only > C_Text turns into a dropdownlist so they can select the proper > chargecode via a dropdownlist > Hours is read/write > > What is the best way to do this? I would have thought I add a gridview, > configure the datasource to the Time Table. Then, I go to the > ChargecodeID field and ask for it to be converted to a templatefield. > > When i open the templatefield there is a label field in there. I delete > it. I add a dropdownlist. I set its datasource to a source linked to > the ChargeCode Table. I go to Choose datasource and select c_text as > the field to display, ChargeCodeID as the value for the dropdown. > > Next I go to edit data bindings and for Selectedvalue I set field > binding to ChargeCodeID > > > When I try to open the page I get an error message > > 'DropDownList1' has a SelectedValue which is invalid because it does > not exist in the list of items. > Parameter name: value > Description: An unhandled exception occurred during the execution of > the current web request. Please review the stack trace for more > information about the error and where it originated in the code. > > Exception Details: System.ArgumentOutOfRangeException: 'DropDownList1' > has a SelectedValue which is invalid because it does not exist in the > list of items. > Parameter name: value > > Source Error: > > An unhandled exception was generated during the execution of the > current web request. Information regarding the origin and location of > the exception can be identified using the exception stack trace below. > > > Stack Trace: > > > [ArgumentOutOfRangeException: 'DropDownList1' has a SelectedValue which > is invalid because it does not exist in the list of items. > Parameter name: value] > System.Web.UI.WebControls.ListControl.PerformDataBinding(IEnumerable > dataSource) +1777763 > System.Web.UI.WebControls.ListControl.OnDataBinding(EventArgs e) > +104 > System.Web.UI.WebControls.ListControl.PerformSelect() +31 > System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70 > System.Web.UI.Control.DataBindChildren() +216 > System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +216 > System.Web.UI.Control.DataBind() +12 > System.Web.UI.Control.DataBindChildren() +216 > System.Web.UI.Control.DataBind(Boolean raiseOnDataBinding) +216 > System.Web.UI.Control.DataBind() +12 > System.Web.UI.WebControls.GridView.CreateRow(Int32 rowIndex, Int32 > dataSourceIndex, DataControlRowType rowType, DataControlRowState > rowState, Boolean dataBind, Object dataItem, DataControlField[] fields, > TableRowCollection rows, PagedDataSource pagedDataSource) +221 > System.Web.UI.WebControls.GridView.CreateChildControls(IEnumerable > dataSource, Boolean dataBinding) +3004 > > System.Web.UI.WebControls.CompositeDataBoundControl.PerformDataBinding(IEnumerable > data) +59 > System.Web.UI.WebControls.GridView.PerformDataBinding(IEnumerable > data) +11 > > System.Web.UI.WebControls.DataBoundControl.OnDataSourceViewSelectCallback(IEnumerable > data) +111 > System.Web.UI.DataSourceView.Select(DataSourceSelectArguments > arguments, DataSourceViewSelectCallback callback) +29 > System.Web.UI.WebControls.DataBoundControl.PerformSelect() +149 > System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70 > System.Web.UI.WebControls.GridView.DataBind() +4 > System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82 > > System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() > +69 > System.Web.UI.Control.EnsureChildControls() +87 > System.Web.UI.Control.PreRenderRecursiveInternal() +41 > System.Web.UI.Control.PreRenderRecursiveInternal() +161 > System.Web.UI.Control.PreRenderRecursiveInternal() +161 > System.Web.UI.Page.ProcessRequestMain(Boolean > includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) > +1360 > > > > Any help out there?
Read and write database
Help - Timing Logic Datagridview...cell contents Newbie Question here Newbie help: How to detect when a worker thread ihas completed normaly newbie syntax question: adding event handler for button not working Unable to write to file in my web site Serial ports. [OT] VB.Net and MS Access Why does Join method call sit there forever? |
|||||||||||||||||||||||