E
eg
Below is the code I am using to create the columns for a datagrid in
code. Once I create them I populate 1 row and return the dataview to
display the results in the grid on the ASP.Net web page, but nothing is
showing up. What am I missing?
TIA
protected void btnSW_Click(object sender, EventArgs e)
{
grdSW.DataSource = CreateData();
grdSW.DataBind();
}
public DataView CreateData()
{
DataTable lTbl = new DataTable();
lTbl.Columns.Add("FirstName", typeof(String));
lTbl.Columns.Add("LastName", typeof(String));
DataRow dr;
dr = lTbl.NewRow();
dr[0] = "Hello";
dr[1] = "Lap Top";
lTbl.Rows.Add(dr);
DataView dv = new DataView(lTbl);
return dv;
}
code. Once I create them I populate 1 row and return the dataview to
display the results in the grid on the ASP.Net web page, but nothing is
showing up. What am I missing?
TIA
protected void btnSW_Click(object sender, EventArgs e)
{
grdSW.DataSource = CreateData();
grdSW.DataBind();
}
public DataView CreateData()
{
DataTable lTbl = new DataTable();
lTbl.Columns.Add("FirstName", typeof(String));
lTbl.Columns.Add("LastName", typeof(String));
DataRow dr;
dr = lTbl.NewRow();
dr[0] = "Hello";
dr[1] = "Lap Top";
lTbl.Rows.Add(dr);
DataView dv = new DataView(lTbl);
return dv;
}