Adding Alert message for specific nodes at runtime

1 posts, 0 answers
  1. Sudhanva
    Sudhanva avatar
    27 posts
    Member since:
    Apr 2009

    Posted 25 Sep 2009 Link to this post

    Hi,

    I want to add an alert message to some nodes in my RadTreeView.
    Following is my code.

    int temp = 0;  
            foreach (RadTreeNode node in rdtreeTeamBrand.Nodes)  
            {  
                if (node.Nodes.Count > 0)  
                {  
                    for (int i = 0; i < node.Nodes.Count; i++)  
                    {  
                        RadTreeNode brandNode = node.Nodes[i];  
                        foreach (DataRow row in tblTeamBrandDetails.Rows)  
                        {  
                            if (node.Value == row["TeamID"].ToString() && brandNode.Value == row["BrandID"].ToString())  
                            {  
                                node.Checked = true;  
                                brandNode.Checked = true;  
                                temp = Convert.ToInt32(objconfig.CheckBrandSwotForPlanPeriod(Convert.ToInt32(node.Value), Convert.ToInt32(brandNode.Value), PlanningPeriodID));  
                                if (temp != 0)  
                                {   //this is where im adding the radalert at..  
                                    brandNode.Attributes.Add("onclick",   
                                        string.Format(@"   
                                    function _showAlert() {{Sys.Application.remove_load(_showAlert);      
                                    radalert('{0}', null, 100, '{1}');}};      
                                    Sys.Application.add_load(_showAlert);""Brand will be excluded from the PlanningPeriod.""Novartis iPlan"));  
     
                                    brandNode.ForeColor = System.Drawing.Color.Navy;  
                                }  
                            }  
                        }  
                    }  
                }  
            } 

    This is how a part of the Treeview looks in html
    <div class="rtTop">  
                                            <span class="rtSp"></span><input type="checkbox" class="rtChk" /><span class="rtIn">AFIN</span> 
                                        </div></li><li class="rtLI"><div class="rtMid">  
                                            <span class="rtSp"></span><input type="checkbox" class="rtChk" /><span class="rtIn">FEM</span> 
                                        </div></li><li class="rtLI"><div class="rtMid">  
                                            <span class="rtSp"></span><input type="checkbox" class="rtChk" checked="checked" /><span class="rtIn" onclick="     
                                    function _showAlert() {Sys.Application.remove_load(_showAlert);        
                                    radalert('Brand will be excluded from the PlanningPeriod.', null, 100, 'Novartis iPlan');};        
                                    Sys.Application.add_load(_showAlert);" style="color:Navy;">PROLE</span> 
                                        </div> 

    This is not working. I am getting a alert with null as text, onclick of these nodes.

    Please help.
Back to Top