开发者

Creating controls in ASP with dynamic IDs

I'm creating a chat widget that will be dropped into CommunityServer. The widget works great, but I just discovered that if I drop two of these widgets onto the same page, only one of them works! And I'm quite certain the reason is because the chat window is defined in ASP, and now there are two instances of the chat window, with the same ID, on the same page.

I am doing this with straight ASP & Javascript (not by choice), so my chat window is defined as: <telerik:RadListBox ID="rlbMessages" runat="ser开发者_StackOverflow社区ver" > (don't mind that it's a telerik control).

So I was hoping I could do something like this: <telerik:RadListBox ID="<%= 'rlbMessages' + chatRoomID %>" runat="server" >

But from what I've gathered, apparently you can't assign ID's this way? What is the alternative?


With Telerik and .NET in general you'l find the code likes to own all the IDs. As a work-around you can use unique CSS class names.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜