views:

144

answers:

2

Hey all, I'm hoping I can get some quick help on this as I've been stuck here for the last week and can't move on until I get this figured out!

I have a dynamically created CheckBoxList in a DotNetNuke module I'm building. When DNN creates the page, it prepends the control name with the moduleID and moduleName. So, when I have "AddLicenseCheckBoxList" on the page, it becomes: "dnn_ctr949_addRateGroup_AddLicenseCheckBoxList" depending on what the ModuleID and page name is (in this instance it's 949 and addRateGroup respectively). Now, I don't know what the name of the page or moduleID will be when this module is finished, so I need to make sure I am accessing the control my whateer name DNN gives it, and getElementById or getElementByName do not work even when using '<%= %>'.

So what I need to do is use Javascript or some VB to retrieve the checked values of the dynamically created CheckBoxList so that I can run an update on the database with those selected values.

I've tried everything and even posted on Experts Exchange here: http://www.experts-exchange.com/viewQuestion.jsp?qid=25350327

if anyone is interested in points on that site. Please help if you can, I'm so stumped!

+2  A: 

To get the ID of the rendered HTML element, you can use the ClientID property. So, in your case, you can use document.getElementById('<%=AddLicenseCheckBoxList.ClientID%>') to access the checkbox list element.

bdukes
I tried that, and I can't get anything to happen. I want to put the value of all the checked items into a label or a textbox, but to try to get anything to happen, I just used an alert and have the following code:function CopyItemsToTextBox() {var checkBoxList = document.getElementById('<%=AddLicenseCheckBoxList.ClientID%>')var n = checkBoxList.length;var myString = "";for (var i = 0; i < n; i++) {var checkBox = document.getElementById(checkBoxList.id + '_' + [i]);if (checkBox != null }}
cmmitw
A: 

I found a post that does exactly what I want without using JavaScript....thanks!

http://www.syncfusion.com/FAQ/aspnet/WEB_c20c.aspx

cmmitw