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

How to fire server event when clicking checkbox

$
0
0

Hi,

I have listview that works well with the definition below:

<telerik:RadListViewID="lvwUserGroups"runat="server"ItemPlaceholderID="groupsPlaceholder"OnNeedDataSource="lvwUserGroups_NeedDataSource"
    DataKeyNames="GroupID">
    <LayoutTemplate>
        <divclass="RadListView RadListView_<%# Master.SkinManager.Skin %>" >
            <tableclass="mainTable">
                <thead>
                    <trclass="rlvHeader">
                        <thclass="thcenter">Enabled</th>
                        <th>Group</th>
                    </tr>
                </thead>
                <tbody>
                    <asp:PlaceHolderid="groupsPlaceholder"runat="server">
                    </asp:PlaceHolder>
                </tbody>
            </table>
        </div>
    </LayoutTemplate>
</telerik:RadListView>

 

protectedclassuserGRPTemplate : ITemplate
{
    privateADScrubWeb.HTMLHelper helper = newADScrubWeb.HTMLHelper();
 
    publicuserGRPTemplate()
    {
    }
 
    publicvoidInstantiateIn(Control container)
    {
        TableRow tr = newTableRow();
        container.Controls.Add(tr);
 
        helper.AddControlToParent(container, helper.AddBoundHiddenField("GroupID"));
 
        helper.AddControlToParent(tr, helper.AddBoundCheckBox("Enabled"), true, HorizontalAlign.Center);
        helper.AddControlToParent(tr, helper.AddBoundTextBox("GroupName", BorderStyle.None, true), true, HorizontalAlign.Left);               
    }
}

 

publicCheckBox AddBoundCheckBox(stringcontrolID)
{
    CheckBox tmp = newCheckBox();
    tmp.ID = controlID;
    tmp.DataBinding += delegate(objectsender, EventArgs args)
    {
        CheckBox control = ((CheckBox)sender);
        RadListViewDataItem listViewDataItem = ((RadListViewDataItem)control.NamingContainer);
        control.Checked = lsuGeneral.IsTrue(DataBinder.Eval(listViewDataItem.DataItem, controlID).ToString());
    };
    returntmp;
}

 

I would like to react to the user clicking the bound checkbox so I can do auto-updates without the user clicking an update button. I tried wiring up the checkbox CheckedChange event in the ITemplate but that didn't fire, anyway I would still need to know which row's checkbox was clicked.

Any ideas?

 

 

 


Viewing all articles
Browse latest Browse all 94857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>