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(); |
} |