void cmdSearch_Click(object sender, EventArgs e) { if (! _parent.RenderMethod.StartsWith("UDT_Xsl")) { _parent.CurrentPage = 1; IsSearching = true; } else { var @params = new List<string>(); var moduleId = _parent.ModuleId; if (! string.IsNullOrEmpty(TxtSearch.Text)) { @params.Add(string.Format("u{0}q={1}", moduleId, TxtSearch.Text.UrlHexEncode())); if (! _parent.Settings.SimpleSearch ) { @params.Add(string.Format("u{0}c={1}", moduleId, DrpSearchableColumns.SelectedValue.UrlHexEncode())); @params.Add(string.Format("u{0}m={1}", moduleId, DrpSearchMode.SelectedValue)); } var url = Globals.NavigateURL(_parent.TabId, "", @params.ToArray()); _parent.Response.Redirect(url); } // Such paramter } }
void WriteData(DataTable data, DataTable fields, string folder, string fileName, string delimiter) { using (var sw = new StringWriter()) { var columns = new List<string>(); //Writing top line with column names foreach (DataRow row in fields.Rows) { var typeName = (row[FieldsTableColumn.Type].ToString()); //ignore system fields if (DataType.ByName(typeName).IsUserDefinedField) { columns.Add(row[FieldsTableColumn.Title].ToString()); } } //write colums name as first line CSVWriter.WriteCSV(columns.ToArray(), sw, delimiter); //writing data foreach (DataRow row in data.Rows) { var values = new List<string>(); //getting values for all colums foreach (var fieldTitle in columns) { var valueName = ((data.Columns.Contains(fieldTitle + DataTableColumn.Appendix_Original)) ? fieldTitle + DataTableColumn.Appendix_Original : fieldTitle); var value = row[valueName].AsString(); values.Add(value); } CSVWriter.WriteCSV(values.ToArray(), sw, delimiter); } WriteFile(folder, fileName, sw); } }