/// <summary> /// Agrega una nueva opcion de menu en el Menu principal de la aplicacion /// </summary> private COSEVI.web.controls.option agregarOpcion(string ps_titulo, string ps_cssClass, string ps_url, string height, COSEVI.web.controls.option po_padre) { COSEVI.web.controls.option vo_opcion = new COSEVI.web.controls.option(); vo_opcion.Text = ps_titulo; vo_opcion.Url = ps_url; vo_opcion.CssClass = ps_cssClass; vo_opcion.Padre = po_padre; vo_opcion.Height = height; if (po_padre != null) { po_padre.addOption(vo_opcion); } else { this.menu.addOption(vo_opcion); } return vo_opcion; }
private void agregarOpcionesHijas(int pi_padre, DataTable po_menu, COSEVI.web.controls.option po_opcion) { try { EnumerableRowCollection vo_query = null; COSEVI.web.controls.option vo_opcion = null; if (po_menu != null && po_menu.Rows.Count > 0) { //Se seleccionan las primeras opciones. vo_query = from row in po_menu.AsEnumerable() where row.Field<int>("padre") == pi_padre orderby row.Field<int>("menu") ascending select row; //Por cada padre se agrega al menu una opcion foreach (DataRow row in vo_query) { vo_opcion = this.agregarOpcion(row["titulo"].ToString(), String.Empty, row["url"].ToString(), row["height"].ToString(), po_opcion); this.agregarOpcionesHijas(Convert.ToInt32(row["menu"]), po_menu, vo_opcion); } } } catch (Exception) { throw; } }