Hello,
I'm building up a grid programmatically. I add GridItemColumns by setting their TemplateColumn and FilterColumn to classes that inherit from ITemplate. I'm currently working on adding a multiselect dropdown filter template. I'm able to get the control to display, I just need help getting the javascript function to work correctly. The function fires on the checkbox "Onclick" event. If I can figure out how to access the combo box from within this javascript function, I'll be fine.
My class that inherits ITemplate, adds the onclick event to the checkbox. I've added the onclick function to the main calling page. When the user clicks the checkbox, it's fired. The comboId is the combobox "ClientID". How can I pass a reference to this javascript function and access the combo box?? Please note, the checkbox inside the comboboxitem is the control firing this event and it's the "chk" parameter below:
My Main Page which contains the grid control:
This is the "InstantiateIn" method for the "ItemTemplate" section of the combo box.
Thanks,
I'm building up a grid programmatically. I add GridItemColumns by setting their TemplateColumn and FilterColumn to classes that inherit from ITemplate. I'm currently working on adding a multiselect dropdown filter template. I'm able to get the control to display, I just need help getting the javascript function to work correctly. The function fires on the checkbox "Onclick" event. If I can figure out how to access the combo box from within this javascript function, I'll be fine.
My class that inherits ITemplate, adds the onclick event to the checkbox. I've added the onclick function to the main calling page. When the user clicks the checkbox, it's fired. The comboId is the combobox "ClientID". How can I pass a reference to this javascript function and access the combo box?? Please note, the checkbox inside the comboboxitem is the control firing this event and it's the "chk" parameter below:
My Main Page which contains the grid control:
function onCheckBoxClick(chk, comboId) {
var text = "", values = "";
var combo = $find(comboId);
if (combo != null) {
alert('Found ComboBox');
var items = combo.get_items();
if (items != null) {
alert('Found Items');
alert('Num Items: ' + items.length);
} else {
alert('NOT Found Items');
}
} else {
alert('NOT Found ComboBox');
}
This is the "InstantiateIn" method for the "ItemTemplate" section of the combo box.
public void InstantiateIn(Control container)
{
chkBox = new CheckBox();
chkBox.ID = string.Format("msChk_{0}", Column);
RadComboBoxItem item = (container as RadComboBoxItem);
RadComboBox box = (item.Owner as RadComboBox);
string _onClick = "";
_onClick = string.Format("onCheckBoxClick({0}, {1})", "this", box.ClientID.ToString());
chkBox.Attributes.Add("onclick", _onClick);
chkBox.Text = item.Text;
container.Controls.Add(chkBox);
}
Thanks,