Bind Header To grid using grid view row create event

if (e.Row.RowType == DataControlRowType.Header) { //Build custom header. GridView oGridView = (GridView)sender; GridViewRow oGridViewRow = new GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Insert); TableCell oTableCell = new TableCell(); oTableCell = new TableCell(); oTableCell.Text = “”; //oTableCell.CssClass = “header”; /*Header*/ oGridViewRow.Cells.Add(oTableCell); oTableCell = new TableCell(); oTableCell.Text = “<b>Style Code</b>”; //oTableCell.CssClass = “header”; /*Header*/ oGridViewRow.Cells.Add(oTableCell); oTableCell = new TableCell(); oTableCell.TextContinue Reading “Bind Header To grid using grid view row create event”

Create thumbnail with category folder

try { Product obj_Product = new Product(); string[] filePaths = Directory.GetFiles(Server.MapPath(“~\\”+ Common.WebImageFolder )); foreach (string filePath in filePaths) { File.Delete(filePath); } string[] imageDirectory = Directory.GetDirectories(Server.MapPath(“~\\” + Common.WebImageFolder)); obj_Product.cat_ParentcatId = 0; DataTable dt = obj_Product.GetCategoryByParentID(); foreach (string DirectoryName in imageDirectory) { //Console.Write(DirectoryName); string AvailDir = DirectoryName.Substring(DirectoryName.LastIndexOf(@”\”), DirectoryName.Length – (DirectoryName.LastIndexOf(@”\”))); foreach (DataRow dr in dt.Rows) { ifContinue Reading “Create thumbnail with category folder”

Function to bind Multilevel category in dropdown list

int level = -1; private void RecursiveFillTree(DataTable dtParent, int parentID) { level++; //on the each call level increment 1 StringBuilder appender = new StringBuilder(); for (int j = 0; j < level; j++) appender.Append(“&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;”); if (level > 0) appender.Append(“|__”); DataView dv = new DataView(dtParent); dv.RowFilter = string.Format(“cat_ParentId = {0}”, parentID); int i; if (dv.Count >Continue Reading “Function to bind Multilevel category in dropdown list”

Read excel 2003 file format return dataset

FileToConvert ┬áis path of excel file public DataSet ConvertExcelFiletodataset() { string connectionString = “Provider=Microsoft.Jet.OLEDB.4.0;Data Source=” + FileToConvert + “;Extended Properties=Excel 8.0;”; DataSet ds = new DataSet(); OleDbConnection connection = new OleDbConnection(connectionString); try { connection.Open(); //this next line assumes that the file is in default Excel format with Sheet1 as the first sheet name, adjust accordinglyContinue Reading “Read excel 2003 file format return dataset”