void GetGridView_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.ToLower() != "add") { return; } var row = (e.CommandSource as Control).Parent.Parent as GridViewRow; var htd = new Hashtable(); foreach (TemplateField tf in GridViewManager1.GridView.Columns) { var item = tf.FooterTemplate as GenericItem; if (item == null) { continue; } try { foreach (DictionaryEntry de in item.ExtractValues(row)) { htd.Add(de.Key, de.Value); } } catch (Exception ex) { Exceptions.Logger.Error(ex); HtmlHelper.Alert(ex.Message, Page); return; } } try { var ctrl = new AdminPageController(); var info = new AdminPageInfo(); foreach (System.Reflection.PropertyInfo property in CBO.GetPropertyInfo(typeof(AdminPageInfo))) { if (htd[property.Name] != null) { property.SetValue(info, htd[property.Name], null); } } ctrl.InsertAdminPage(info); GridViewManager1.GridView.PageIndex = GridViewManager1.GridView.PageCount; GridViewManager1.LoadData(); } catch (Exception ex) { Exceptions.Logger.Error(ex); HtmlHelper.Alert(ex.Message, Page); } }
private string CreateMenuItem(bool isRoot, AdminPageInfo page, string subItem) { const string strTemp = @" <li class=""sub""><a href=""{0}"">{1}</a>{2}</li>"; return(string.Format ( strTemp, (isRoot ? "javascript:void(0);" : page.Source), page.Name, ( isRoot ? string.Format ( "<ul class=\"subnav\">{0}</ul>", subItem ) : string.Empty ) )); }