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

Creating radcontextmenu at runtime

1 Answer 43 Views
Menu
This is a migrated thread and some comments may be shown as answers.
Gilberto Anino
Top achievements
Rank 1
Gilberto Anino asked on 11 Jun 2010, 09:58 PM
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(); 
 
    } 

1 Answer, 1 is accepted

Sort by
0
Gilberto Anino
Top achievements
Rank 1
answered on 11 Jun 2010, 10:41 PM
suddenly the radcontextmenu starts to work fine... Don't know why... Sorry and thank you
Tags
Menu
Asked by
Gilberto Anino
Top achievements
Rank 1
Answers by
Gilberto Anino
Top achievements
Rank 1
Share this question
or