Hello,
I've been searching for whole day how we simple can get the value we've checked. If we check or uncheck the "Checkbox" of the treelist, the -SelectionChanged="onClick"- is called on the "Client" & "Server" side. But there's no way to get the "ID" of the checkbox you've just checked or unchecked! If they check a node, an item must be created in the DB (i need the ID for doing that); If they uncheck a node, the item must be deleted in the DB. But how do we get the value? While watching in the debugger in the javascript, I didn't find how to get the ID. Only the "selectionDiff" contains the ID I need, but there no way to get it…
function onClick(s, e) {
//af7a8728-467f-e011-8de3-005056bf5b64
//var id = typeof (s.selectionDiff);
document.getElementById("getNodeKey").value = "Selection Changed";
}
If I watch on the "Server"-side, I don't have an option of getting the actual checked property :
protected void ASPxTreeList1_SelectionChanged(object sender, EventArgs e)
{
//HERE we only can loop trough all the selected and that NOT good!
}
The focused rows functions aren't called yet…
My ASPxTreeList :
<dx:ASPxTreeList ID="ASPxTreeList1" runat="server" AutoGenerateColumns="False"
CssFilePath="~/App_Themes/Office2010Silver/{0}/styles.css"
CssPostfix="Office2010Silver" ondatabound="ASPxTreeList1_DataBound"
oncommandcolumnbuttoninitialize="ASPxTreeList1_CommandColumnButtonInitialize"
onfocusednodechanged="ASPxTreeList1_FocusedNodeChanged"
onhtmlrowprepared="ASPxTreeList1_HtmlRowPrepared"
onselectionchanged="ASPxTreeList1_SelectionChanged"
oncustomcallback="ASPxTreeList1_CustomCallback" >
<Settings SuppressOuterGridLines="True"></Settings>
<SettingsBehavior ProcessFocusedNodeChangedOnServer="True"
ProcessSelectionChangedOnServer="True"></SettingsBehavior>
<Columns>
<dx:TreeListDataColumn FieldName="Name" VisibleIndex="0" />
<dx:TreeListCommandColumn>
<EditButton Visible="True" />
<EditButton Visible="True"></EditButton>
</dx:TreeListCommandColumn>
</Columns>
<Settings SuppressOuterGridLines="True" />
<SettingsBehavior ProcessFocusedNodeChangedOnServer="true" ProcessSelectionChangedOnServer="true" />
<Images SpriteCssFilePath="~/App_Themes/Office2010Silver/{0}/sprite.css">
<LoadingPanel Url="~/App_Themes/Office2010Silver/TreeList/Loading.gif">
</LoadingPanel>
</Images>
<Styles CssFilePath="~/App_Themes/Office2010Silver/{0}/styles.css"
CssPostfix="Office2010Silver">
<LoadingPanel ImageSpacing="5px">
</LoadingPanel>
</Styles>
<StylesEditors ButtonEditCellSpacing="0">
</StylesEditors>
<ClientSideEvents SelectionChanged="onClick" />
</dx:ASPxTreeList>
I bind the data on the "Page_Load", where I put "ID" as the actual datakey :
ASPxTreeList1.KeyFieldName = "ID";
ASPxTreeList1.ParentFieldName = "TypeID";
Each time the "DB" is build, we set which fields needs to be selected and such… So I can't see which were checked or unchecked. That's why I realy need the ID to do the needed work!
As extra addition, I need to be able to update only the "Selected" Items => Nothing else can be updated… I figured out how to set the "Edit"-button on the "CHECKED" fields and so, but how do I define my own custom "Update"-Fields, based on other data from another table => When the node is checked it means that there is another table that is connected to that "ID". It's that data we need to update and there are some CUSTOM COMBOBOXES I need to build, but how do I achieve this? Is the "ASPxTreeList" control strong enough to support this? I really need a fast answer on this!
Kind Regards,
Frederic