Add custom button to jquery dropdown checklist
I want to put a ASP.NET button when the dropdownlist checklist opens. I am using the jQue开发者_如何学JAVAry-UI dropdownlist checklist. There is an example of what I want below.
Any help is appreciated, thanks.
Well, I suppose you would see how it can be done in JQuery rather than in asp.net. Since you are styling the DropDownList using JQuery, I would continue down that road. I am not familiar with the UI control for JQuery to offer an example, but I would see if you can attach the Button1 control to that list via JQuery. I am thinking, maybe in your codebehind, you dynamically create the button control and add it to the controls collection of the page. Then, have the page render your JQuery so that button appears inside the DropDownList.
Thanks for the code.
There are probably a number of ways to do this. One thing to recognise is that the built in controls with ASP.NET are rigid in the HTML they produce. For lots of modern UI / dynamic methods they can cause problems by their inflexibility.
First I'd suggest coding the HTML manually so it is working how you want with the jquery functions. Look at other Jquery examples and possibly Jquery UI also.
When you are happy I'd then do one of the following things.
a) Write your own custom control or extend the existing asp:DropDownList.
b) Manually write the HTML out in the page with a loop. This isn't as elegant or reusable but is might be technically simpler if you haven't written custom controls before however I would recommend a).
Finally. Be aware that your finished HTML shouldn't be inserting anything other than OPTION tags into the SELECT tags within the HTML. If that is your approach you need to re-think the structure of the HTML, hence suggesting that as your first set.
Hope that helps.
精彩评论