This is a migrated thread and some comments may be shown as answers.

Automatic Update Checkboxes with Datasource?

2 Answers 67 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Stefan
Top achievements
Rank 2
Stefan asked on 23 Apr 2013, 10:54 PM
This is probally easy question for somebody but I am a little green to Telerik and Ajax.  I have a radlistbox bound to a datasource, it has 3 fields, id, desc and flag.  I have it populating just fine but what fires the automatic update event?  All the items that are flag are on or off as they should be but when I click the checkbox to turn an item on or off the listbox doesn't even appear to do anything.  Do I need some code behind other than automatic updates = true and post back = true to make the update to the checkbox save to the database? 

            <telerik:RadListBox ID="lbOrgLevels" runat="server" DataSourceID="sqlGetOrgLevels" DataKeyField="OrgLevelID" CheckBoxes ="true" style="top: 0px; left: 0px; width: 459px" OnItemDataBound="lbOrgLevels_ItemDataBound" AllowAutomaticUpdates="True" AutoPostBack="True" Skin="Sitefinity" DataSortField="OrgLevelDescription" DataTextField="OrgLevelDescription" DataValueField="Active">
            </telerik:RadListBox>

            <UpdateParameters>
                <asp:Parameter Direction="Input" Name="Active" Type="Boolean"></asp:Parameter>
                <asp:Parameter Direction="Input" Name="OrgLevelID" Type="Int32"></asp:Parameter>
            </UpdateParameters>

Protected Sub lbOrgLevels_ItemDataBound............
        e.Item.Text = (DirectCast(e.Item.DataItem, DataRowView))("OrgLevelID").ToString().Trim() _
                 + "- " + (DirectCast(e.Item.DataItem, DataRowView))("OrgLevelDescription").ToString().Trim()

        e.Item.Value = (DirectCast(e.Item.DataItem, DataRowView))("Active").ToString()
        e.Item.Checked = (DirectCast(e.Item.DataItem, DataRowView))("Active").ToString()
        e.Item.DataBind()
End Sub


thanks for any help.

2 Answers, 1 is accepted

Sort by
0
Stefan
Top achievements
Rank 2
answered on 25 Apr 2013, 02:55 PM
Anyone? I am still stuck on how to make the checkboxes update automically with the DB when checked or unchecked.
0
Nencho
Telerik team
answered on 26 Apr 2013, 03:30 PM
Hello Stefan,

The desired functionality could not be achieved with the Automatic Updates approach, because it is implemented, regarding the main operations of the RadListBox - transfer, reorder, delete.

Regards,
Nencho
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
ListBox
Asked by
Stefan
Top achievements
Rank 2
Answers by
Stefan
Top achievements
Rank 2
Nencho
Telerik team
Share this question
or