Hi, I have a grid where i have to filter the columns like multiple search filter and what ever records i get in the grid i am doing export to excel in c# Everything was went well except the date column in the grid the date column data is in this format 2014/11//15 here is my c# code which i am using to remove special characters private void getfilterdata(string filter, out string key, out string val) { key = string.Empty; val = string.Empty; if (!string.IsNullOrEmpty(filter)) { string[] retval2 = filter.Split(new string[] { "data" }, StringSplitOptions.RemoveEmptyEntries); if (retval2 != null && retval2.Count() > 1 && !string.IsNullOrEmpty(retval2[1])) { string[] strkeys = retval2[0].Split(new char[] { '"' }, StringSplitOptions.RemoveEmptyEntries); if (strkeys.Length >= 3 && !string.IsNullOrEmpty(strkeys[3])) { key = strkeys[3]; val = RemoveSpecialCharacters(retval2[1]); } } } } In the key its shows column name and in the val it shows data.. in the val i am getting data as 20141115. So its not matching and while exporting its empty i am not getting any records becaus e of this this is my code for RemoveSpecialCharacters public static string RemoveSpecialCharacters(string str) { return Regex.Replace(str, "[^a-zA-Z0-9_.]+", "", RegexOptions.Compiled); } Any help plz.....
parkway
Posts
-
issue with date format when exporting to excel -
Is there a way to capture all the page records in jqgrid when exporting to excelBut only the data in current grid was captured using the following method mya=jQuery(”#list2″).getDataIDs(); // Get All IDs" If I like to export all data (e.g. totally 18 records, 10 displayed in current grid and 8 in second grid page), is there a way to capture all 18 records without invoking the backend? i am not finding any solution only first page data is capturing in excel ... I am using var jqgridRowIDs = $(tableCtrl).getDataIDs(); // Fetch the RowIDs for this grid var allJQGridData = $(tableCtrl).jqGrid('getRowData'); var headerData = $(tableCtrl).getRowData(jqgridRowIDs[0]); Plz help me out.....
-
dropdown edit type selection to read mode for few records.hi, I have a requirement in the jqgrid data that totally 3 columns in that one is name,date and one column called department where the edit type is select have two options education and humanresources. for some records like up to this month 10/31 the records should be editable , i mean we can select some thing and we can update. only the current month should be editable and next month data should not editable we can view it but not edit just like should be in read mode. How to approach this scenario? $("#grid").jqGrid({ url: 'Handler.ashx', datatype: 'json', height: 250, colNames: ['Name','Department', 'Date'], colModel: [ { name: 'Name', index: 'Name', width: 256, stype: 'text', editable: true, sortable: false, editoptions: { disabled: "disabled"} }, { name: 'Department', index: 'Department', width: 256, stype: 'text', sortable: false, editable: true, edittype: 'select', formatter: rowColorFormatter, editoptions: { value: "Education:Education; Humanresource:Humanresource" }}, { name: 'Date', index: 'Date', width: 256, editable: true, stype: 'text', sortable: true, sorttype: 'date', editoptions: { disabled: "disabled"} } ], rowNum: 100, loadonce: true, rowList: [100, 200, 300], pager: '#pager', sortname: 'name', viewrecords: true, sortorder: 'asc', gridview: true, ignoreCase: true, caseSensitive: false, rownumbers: true, reloadAfterSubmit: false, width: 1024, gridComplete: function() { for (var i = 0; i < rowsToColor.length; i++) { var Department = $("#" + rowsToColor[i]).find("td").eq(2).html(); if (Department == "Humanresource") { $("#" + rowsToColor[i]).find("td").css("background-color", "red"); } } }, jsonReader: { repeatitems: false }, caption: 'Department Update', editurl: 'Handler.ashx', onSelectRow: function(id) { if (id && id !== lastSelectedId) { $('#grid').restoreRow(lastSelectedId); $('#grid').editRow(id, true); lastSelectedId = id; } }, afterSubmit: function() { $(this).jqGrid("setGridParam", { datatype: 'json' }); return [true]; alert("returnvalue"); } }); function rowColorFormatter(cellValue, options, rowObject) { if (cellValue == "Humanresources") rowsToColor[rowsToColor.length] = options.rowId; return cellValue; }; $("#grid").setGridParam({ sortname: 'CalDate', sortorder: 'asc' }).trigger('reloadGrid'); $("#grid").jqGrid('navGrid', '#pager', { edit: false, add: false, del: false, search: true, searchtext: "Search", reloadAfterSubmit: true, cloneToTop: true, overlay: false, beforeRefresh: functio