0
votes

I want to add a row on top of Gridview, meaning that wants to add a row ON gridview as first record. Sample code as follows ` protected void getfinaldetails_Click(object sender, EventArgs e) {

        DataSet ResultDS = new DataSet();
        //  string timespan = TimeSelection.SelectedValue;

        string fromdate = txtfromDate.Text;
        string todate = txtToDate.Text;

        string freepermit = "paid";
        Label1.Text = "Paid Permit Amount Details";
        Label2.Visible = false;
        ResultDS = DLCON.AdminAmount(fromdate, todate, freepermit);



        GridAmountView.DataSource = ResultDS;
        GridAmountView.DataBind();


    }

`

1

1 Answers

0
votes

You could create a new DataTable and bind that to the gridview, but it does not use DLCON.

System.Data.DataTable dt = new System.Data.DataTable();
dt.Columns.Add("fromdate", typeof(string));
dt.Columns.Add("todate", typeof(string));
dt.Columns.Add("freepermit", typeof(string));
dt.Rows.Add(new object[] { fromdate, todate, freepermit });

if you get a DataSet (which has tables inside), you want to use something like myDataSet.Tables[0] to get the first table.