Itemupdating findcontrol

13-Aug-2017 08:06

For some reason, during the grid's creation, the item bound events aren't called for Edit Template, even though the controls are created ahead of time. Are you saying that you cannot use Find Control() on any Edit Item Template control?

I also tried looking into the Item Created event, but no luck there. And one workaround is to use a sqldatasource (embedded db connection in the page) to handle this as opposed to the Find Control method inside of Item Data Bound, for instance? Generally, the Find Control() method should work with templates: If you are using Batch editing mode, please note that it is different than other modes.

To switch from edit mode to display mode, set this property to -1.

Now click on Edit button you will see the following output.

As a result, when user switches to Details View Edit mode, where Selected Value property of the List Box control is used, we get error stating "Value that we are trying to select is not present in the Listbox Items”, which is basically a NULL value.

- To get rid of this situation, some of the customers were trying to get the reference of the List Box control, as soon as the Label is blank so that they can change the Selected Value property dynamically.- We will get the reference of Listbox control inside Item Updated(Item Updating) event that will be called while Updating the Details View control.

I am browsing around for days trying to find a solution now and just found a lot of other people having problems with dropdownlists in List View as well but no solution in sight so far :( Finding the control in Pre Render seems to work, although that doesn't really help, because I need the control On Item Updating, here is a little more detailed explanation of what I am trying to do.

I created a dropdownlist from a datasource programmatically (code below) Fill DDLProject Manager is executed On Init of the dropdownlist in List View5 in the Insert Template and in List View5select in the Edit Template.

Second suggestion: Check if you ddl in the Edit tempalte isn't inside another templated control, this would require you to do a Find Control in the tempalted control first and then, a Find Control in the tempalted control looking for the ddl. Both dropdowns are directly in Insert Item and Edit Item respectively and while the dropdown in the Insert Item is found with no probs it just won't work with the Edit Item.Is Valid) protected void List View5select_Item Updating(object sender, List View Update Event Args e) { if (Page.