R – Custom list form using sharepoint object model VS 2008

formslistsharepoint

Is there a way to handle the DropDownSelectedIndexChanged for list item new form.

Let say I have a custom list named Temp having Title, Products (which is a DropDownList) and Color Shade (which is a TextBox).
When I create a list item I want to select a product from DropDownList and on the selected index changed I want to write the
business logic such as fetching the row from Color Shade list and bind the data to TextBox of Color Shade. Now I can say ok so that
a list item will be created. Is it possible using VS 2008 sharepoint object model.

Best Answer

you could add a custom control to your masterpage which resursively traverses your control tree (start from this.Page) to find your dropdown and attaches the event handler (which itself is defined in your custom control). Also set the AutoPostBack property to true on the dropdown once you found it.

In terms of getting a reference do your textbox within your eventhandler, you could also apply the same approach of traversing the control tree.

note, you need to ensure that event handler is attached before eventhandlers are run.

Jaap

Related Topic