Is it possible to change the value of custom attribute on the client side then access it on the server side?
Because I'm trying to change some value of custom attribute on the client side and try to get it during post back, but the value that I get is still the initial value when i created the attribute.
below is my sample code
client script
<script type="text/javascript">
var activenode = null;
function $(id){return document.getElementById(id);}
function AppySetting(){
if (activenode!=null){
activenode.setAttribute('AllowAdd' ,(($('AllowAdd' ).checked)? 'True':'False'));
activenode.setAttribute('AllowEdit' ,(($('AllowEdit' ).checked)? 'True':'False'));
activenode.setAttribute('AllowDelete',(($('AllowDelete').checked)? 'True':'False'));
}
}
function OnClientNodeClicked(sender, args)
{
activenode = args.get_node().get_attributes();
$('AllowAdd' ).checked = activenode.getAttribute('AllowAdd' )=='True';
$('AllowEdit' ).checked = activenode.getAttribute('AllowEdit' )=='True';
$('AllowDelete').checked = activenode.getAttribute('AllowDelete')=='True';
}
</script>
server code :
aspx page
<telerik:RadTreeView id="RadTreeViewBackOffice" runat="server"
CheckBoxes="True" TriStateCheckBoxes="true" CheckChildNodes="true"
OnNodeDataBound="OnNodeDataBound"
OnClientNodeClicked="OnClientNodeClicked"
OnClientNodeChecking="OnClientNodeClicked" />
code behind :
protected
void OnNodeDataBound(object sender, RadTreeNodeEventArgs e ){
e.Node.Attributes.Add("AllowAdd" ,"True");
e.Node.Attributes.Add("AllowEdit" ,"True");
e.Node.Attributes.Add("AllowDelete" ,"True");
}
protected void OnClick(object sender, EventArgs e )
{
foreach(RadTreeNode Node in RadTreeViewBackOffice.CheckedNodes){
Response.Write(Node.Attributes["AllowAdd"]);
}
when I call the method Onclick the value of the Attribute is still the same ("True") even i set "False" in the client side.
regards