How to fire the DropDownList.SelectedIndexChanged event
-
I have a vb.net (WebForm) program that is for initial data entry and if the transaction needs to be corrected it doubles as Edit/Update. I have a series of DropDownLists that work perfect when in initial entry mode. The problem comes when re-populating the transaction and appropiate dropdownlists are being populated in the code-behind. The problem is that the dropdownlists need to be populated with all employees and then the specific employee that is to appear (normally selected, now force selected in code-behind) does not fire the SelectedIndexChanged Event a second time without a page level update. Normally just changing the SelectedValue will cause the correct employee to appear. But, all of the elements of the dropdownlist have just been set, so the system does not recognize the new selection as one that is to be displayed. With SelectedIndexChanged being a "Server Side" Event is there a way to force this event from the clientside in code-behind? Or maybe there is a way to reset the selectedindexchanged property to think is has not been changed yet? If so, could you be kind enough to supply an example?
-
I have a vb.net (WebForm) program that is for initial data entry and if the transaction needs to be corrected it doubles as Edit/Update. I have a series of DropDownLists that work perfect when in initial entry mode. The problem comes when re-populating the transaction and appropiate dropdownlists are being populated in the code-behind. The problem is that the dropdownlists need to be populated with all employees and then the specific employee that is to appear (normally selected, now force selected in code-behind) does not fire the SelectedIndexChanged Event a second time without a page level update. Normally just changing the SelectedValue will cause the correct employee to appear. But, all of the elements of the dropdownlist have just been set, so the system does not recognize the new selection as one that is to be displayed. With SelectedIndexChanged being a "Server Side" Event is there a way to force this event from the clientside in code-behind? Or maybe there is a way to reset the selectedindexchanged property to think is has not been changed yet? If so, could you be kind enough to supply an example?
I think you shouldnt rely on serverside events. Rather call the method to repopulate the control yourself. :)
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Simplify Code Using NDepend
Basics of Bing Search API using .NET
Microsoft Bing MAP using Javascript -
I think you shouldnt rely on serverside events. Rather call the method to repopulate the control yourself. :)
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Simplify Code Using NDepend
Basics of Bing Search API using .NET
Microsoft Bing MAP using JavascriptI agree with you on that. Please follow the logic here and make a suggestion with code sample if appropiate. This is a bound dropdownlist.. DataFieldText = EmployeeName DataFieldValue = EmployeeID So I Deliver all of the employees to the DropDownList first and that works. All Employees are in the dropdownlist just fine. On the update path in the program, before the first display of the page, I set SelectedValue = EmployeeID, for the employee to be edited. This should cause that employee info to be displayed when the page is presented for the first time and it is not... Any ideas on why? Thanks in advance for your assistance.. Chuck...
-
I think you shouldnt rely on serverside events. Rather call the method to repopulate the control yourself. :)
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Simplify Code Using NDepend
Basics of Bing Search API using .NET
Microsoft Bing MAP using Javascript -
Problem resolved.. Appears to have been a combination of programmer error and Data corrupted by the infamous Trailing SPACE. Thanks for your input. Made me go back and go line by line and letter by letter...
Wow.. Thats great to hear that. :cool::thumbsup:
Abhishek Sur **Don't forget to click "Good Answer" if you like this Solution.
My Latest Articles-->** Simplify Code Using NDepend
Basics of Bing Search API using .NET
Microsoft Bing MAP using Javascript