Click here to Skip to main content
14,732,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I Use this method.DataGridview Craete but Data not despaly gridview Row.how to solve this problum.plz ant one can help me.thank you.

DataTable coldt = new DataTable();
        DataTable hawbb = new DataTable();
        String MAWBNumber = DropdownMAWB.Text.ToString().Trim();
        String hubCode = DropdownHubList.Text.ToString().Trim();
        hawbb = Ih.getHAWBWList(MAWBNumber, hubCode);

        //instance of a datatable  
        //instance of a datarow  
        DataRow drow;
        //creating two datacolums Column1 and Column2    
        DataColumn dcol1 = new DataColumn("Column1", typeof(string));
        DataColumn dcol2 = new DataColumn("Column2", typeof(string));
        //adding datacolumn to datatable  
        coldt.Columns.Add(dcol1);
        coldt.Columns.Add(dcol2);

        //loop the rows
        for (int r = 0; r < hawbb.Rows.Count; r++)
        {
                //instance of a datarow  
                drow = coldt.NewRow();
                //add rows to datatable  
                coldt.Rows.Add(drow);
                //add Column values  
                coldt.Rows[r][dcol1] = hawbb.Rows[r][0].ToString().Trim();
                coldt.Rows[r][dcol2] = hawbb.Rows[r][1].ToString().Trim();

                //set gridView Datasource as dataTable dt.  
                TAXGridview.DataSource = hawbb;
                //Bind Datasource to gridview  
                TAXGridview.DataBind();
        }




I need to bind data from my Dynamic Gridview??
Posted
Updated 29-Sep-13 20:00pm
v3
Comments
xibit89 27-Sep-13 2:57am
   
I think u should put the DataTable coldt = new DataTable() and DataTable hawbb = new DataTable() in ViewState and then u should bind it to ur GridView.

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900