Quantcast
Channel: Telerik Forums RSS
Viewing all articles
Browse latest Browse all 94857

How to fire server event when clicking checkbox

$
0
0

Thanks Maria, I missed that. For anyone else interested, I used something like this in my listview template:

 

    publicvoidInstantiateIn(Control container)
    {
        CheckBox chkIsKey = helper.AddBoundCheckBox("IsKey");
        chkIsKey.AutoPostBack = true;
        chkIsKey.CheckedChanged += chkIsKey_CheckedChanged;
 
        helper.AddControlToParent(chkIsKey);
 
    }
 
    voidchkIsKey_CheckedChanged(objectsender, EventArgs e)
    {               
        CheckBox chk = ((CheckBox)sender);
        if(chk.Checked)
        {
            RadListViewDataItem listViewDataItem = ((RadListViewDataItem)chk.NamingContainer);
             
            //Do something with other controls on this row
            CheckBox someOtherCheckbox = ((CheckBox)listViewDataItem.FindControl("someOtherCheckbox"));
            someOtherCheckbox.Checked = true;
 
 
            //Do something with other controls in this list
            RadListView listView = listViewDataItem.OwnerListView;
            foreach(RadListViewDataItem dataItem inlistView.Items)
            {
                CheckBox xx = ((CheckBox)dataItem.FindControl("xx"));
                xx.Checked = false;
            }
        }
    }
}

Viewing all articles
Browse latest Browse all 94857

Latest Images

Trending Articles



Latest Images