dropdownlist events does not show in properties wi

2020-08-09 09:53发布

I recently found that dropdownlist events are not shown in properties window. I was disappointed. I already hate asp.net designer in visual studio. its slow and full with ugly things like this. please help me. I need to generate events automatically not to write it by hand.

enter image description here

9条回答
霸刀☆藐视天下
2楼-- · 2020-08-09 10:29

The solution is very easy.

It is just simple,it just that you can not see the events in the source view, you have to just switch to the design view to see the events and double click them to generate events. and again come to design view

查看更多
▲ chillily
3楼-- · 2020-08-09 10:36

When using VS2012 this can be done without actually going into Design view. I know the question is specifically for VS2010, but I can't test this answer myself.

In source view simply start adding the appropriate attribute, for example OnServerValidate on a CustomValidator. As soon as you type the = sign the very first item in the list is <Create new event>, which has the same function as double clicking the control.

查看更多
趁早两清
4楼-- · 2020-08-09 10:43

If you want to create OnSelectedIndexChanged Event you can double click your DropDownList in design view.

if not try writing this :

myDropDownList.SelectedIndexChanged += 

and then press tab 2 times. so it will create event handler for you. then you need to copy your handler name and paste it in your control markup.

查看更多
登录 后发表回答