public void FillSuplier() { GvSuplier.ColumnHeadersDefaultCellStyle.Font = new System.Drawing.Font("Arial", 11, FontStyle.Regular); GvSuplier.RowHeadersDefaultCellStyle.Font = new System.Drawing.Font("Arial", 9); GvSuplier.DefaultCellStyle.Font = new System.Drawing.Font("Arial", 9); //this.GvSuplier.RowsDefaultCellStyle.BackColor = Color.Gainsboro; //this.GvSuplier.AlternatingRowsDefaultCellStyle.BackColor = Color.White; try { ds = new DataSet(); ds = DAL.SuplierInfo(); if (ds.Tables[0].Rows.Count > 0) { GvSuplier.DataSource = ds.Tables[0]; GvSuplier.Columns["SupplierId"].Visible = false; GvSuplier.AutoResizeColumns(); if (GvSuplier.Rows.Count >= intSelectedRowId) { GvSuplier.CurrentCell = GvSuplier[2, intSelectedRowId]; } } } catch (Exception ex) { MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
private void txtInput_TextChanged(object sender, EventArgs e) { try { if (txtInput.Text != string.Empty) { string Companycode = txtInput.Text; DataTable dt = new DataTable(); dt = DAL.BindSupplierList(Companycode); if (dt.Rows.Count > 0) { GvSuplier.DataSource = dt; GvSuplier.AutoResizeColumns(); } else { GvSuplier.DataSource = null; } } else { FillSuplier(); } } catch (Exception ex) { MessageBox.Show(ex.Message, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }