Creating radcontextmenu at runtime

2 posts, 0 answers
  1. Gilberto Anino
    Gilberto Anino avatar
    10 posts
    Member since:
    Dec 2009

    Posted 11 Jun 2010 Link to this post

    There's another thread with this topic but nobody answered.

    I'm creating my contexmenu item at run time but I don't know why the event Item_click does not fire. When I add items at desing time, contextmenu works fine. The problem is when  I build my menu from DataBase. When I create my contexmenu item at run time, and clic an item of it, the page postbacks but never fire the item_Click events. 

    My code

    private void CreaMenuContextual(string sTipoCompromiso) 
        { 
            StringBuilder sSql = new StringBuilder(); 
            SqlCommand cmd = new SqlCommand(); 
            ClsData ObjData = new ClsData(ConfigurationManager.ConnectionStrings["MyCnnStr"].ConnectionString); 
     
     
            MenuCompromisos.DataTextField = "text_field"
            MenuCompromisos.DataValueField = "value_field"
     
            sSql.Append("   SELECT text_field, value_field"); 
            sSql.Append(" FROM TABLE"); 
             
            cmd.CommandText = sSql.ToString(); 
     
            MenuCompromisos.DataSource = ObjData.GetDataTable(cmd); 
            MenuCompromisos.DataBind(); 
     
        } 

  2. Gilberto Anino
    Gilberto Anino avatar
    10 posts
    Member since:
    Dec 2009

    Posted 11 Jun 2010 Link to this post

    suddenly the radcontextmenu starts to work fine... Don't know why... Sorry and thank you
Back to Top