Exemplo n.º 1
0
        public void grdfill()
        {
            try
            {
                DataTable dt = new DataTable();
                dt.Columns.Add("Country_name");
                dt.Rows.Add("No Records Found!");

                objData = new MasterData();
                dtTitle = new DataTable();
                dtTitle = objData.Gettitle();
                if (dtTitle.Rows.Count > 0)
                {
                    grdTitle.DataSource = dtTitle;
                    grdTitle.DataBind();
                }
                else
                {
                    foreach (DataColumn cl in dtTitle.Columns)
                    {
                        cl.AllowDBNull = true;
                    }
                    dtTitle.Rows.Add(dtTitle.NewRow());
                    grdTitle.DataSource = dtTitle;
                    grdTitle.DataBind();
                    int columncount = grdTitle.Rows[0].Cells.Count;
                    grdTitle.Rows[0].Cells.Clear();
                    grdTitle.Rows[0].Cells.Add(new TableCell());
                    grdTitle.Rows[0].Cells[0].ColumnSpan = columncount - 2;
                    grdTitle.Rows[0].Cells[0].Text = "No Records Found";
                    grdTitle.Columns[columncount - 2].Visible = false;
                }
                grdTitle.FooterRow.Visible = true;
            }
            catch (Exception ex)
            {

                lblerrmsg.Text = ex.ToString();
            }
        }
Exemplo n.º 2
0
 protected void filltitle()
 {
     MasterData objmsd = new MasterData();
     DataTable dt = new DataTable();
     dt = objmsd.Gettitle();
     ddltitle.DataSource = dt;
     ddltitle.DataTextField = "title_name";
     ddltitle.DataValueField = "title_id";
     ddltitle.DataBind();
     ListItem li = new ListItem("-Select-", "0");
     ddltitle.Items.Insert(0, li);
 }