/// <summary> /// Select appropriate database table and download the data to the client /// </summary> /// <param name="tool"></param> /// <param name="context"></param> protected void downloadContent(BaseCmsAdminTool tool, HttpContext context) { string fileName = tool.ToString() + "_" + DateTime.Now.ToString("yyyy-MM-dd") + ".xls"; GridView gridview1 = new GridView(); try { gridview1 = tool.RenderToGridViewForOutputToExcelFile(); if (gridview1 != null) { OutputDataSetToExcelFile.OutputToResponse(gridview1, fileName, "", "", context.Response); } } catch {} // fail silently. }
/// <summary> /// Select appropriate database table and download the data to the client /// </summary> /// <param name="tool"></param> /// <param name="context"></param> protected void downloadContent(BaseCmsAdminTool tool, HttpContext context) { string fileName = tool.ToString() + "_" + DateTime.Now.ToString("yyyy-MM-dd") + ".xls"; GridView gridview1 = new GridView(); if (tool.GetType().Name.EndsWith("ListUserFeedback")) { gridview1 = new UserFeedbackDb().FetchAllUserFeedbackSubmittedDataAsGrid(); } else if (tool.GetType().Name.EndsWith("ListRegisteredProjects")) { gridview1 = new RegisterProjectDb().fetchAllAsGrid(); } OutputDataSetToExcelFile.OutputToResponse(gridview1, fileName, "", "", context.Response); }