开发者

asp.net event related problem

hello friends i have a check box list which contains all the courses kept in the 开发者_开发问答data base(on page load) now i want that on some event of check box list all branches corresponding to each checked box of course check box list should be list in another check box list(that is the business logic i will do my own) but the problem is that i am not finding any event where i can send all selected check box list value and can generate appropriate result, if any alternate control or solution you can suggest then please suggest me this.


Set the AutoPostBack property to true and in the SelectedIndexChanged event you can loop over the elements that are selected and then bind your second control depending on that.

Another option would be to go for an ajax solution. For this I suggest you take a look at the change event in jQuery to bind to your checkboxlist and use the ajax stack to retrieve the extra information as html and plug that into a span as innerHtml.


I think you need to clarify where your logic sits, and where the information required for that logic to work sits - in order to even know whether you're dealing with a client-side or a server-side technology question There's two basic possibilities:

Either all required inforamtion is already in the loaded page. In that case, this is basically a javascript problem. I'd dive a bit into jQuery here which has excellent capabilities of finding elements based on properties, and manipulating them

Alternatively, some of your logic and/or data remains on the server. In that case, you can

  1. go with the AutoPostBack property XIII mentioned, resulting, as you correctly assume, in a reload after every click.
  2. Have the user click all the checkboxes they like, and then have them click on a "do something now" button which performs a single postback
  3. Transmit the information about the checkbox click to the server via javascript, get a response, and select other boxes accordingly. Again, XIII already mentioned that by "ajax solution".

So I'm just trying to elaborate on what different approaches do for you, and what questions you need to answer yourself before you can proceed to a concrete technical solution.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜