dynamic bind GridView
-
I am a beginner. I want to bind part of fields from DataTable to GridView. data of the datatable from Three different "select". How do? Thanks.
public void binddata() { conn.Open(); OracleCommand cmd = new OracleCommand("SELECT * FROM EMP", conn); OracleDataReader odr = cmd.ExecuteReader(); dt1.TableName = "FXD"; dt1.Load(odr); ds.Tables.Add(dt1); GridView1.DataSource = ds.Tables["FXD"]; GridView1.DataBind(); conn.Close(); } in this way u can bind datatable to gridview..
-
I am a beginner. I want to bind part of fields from DataTable to GridView. data of the datatable from Three different "select". How do? Thanks.
Hi, Use gridview BoundField like this: AccessibleHeaderText="string" ApplyFormatInEditMode="True|False" ConvertEmptyStringToNull="True|False" DataField="string" DataFormatString="string" FooterText="string" HeaderImageUrl="uri" HeaderText="string" HtmlEncode="True|False" InsertVisible="True|False" NullDisplayText="string" ReadOnly="True|False" ShowHeader="True|False" SortExpression="string" Visible="True|False> Set BoundFields then bound grid view with your data table such as previous reply shown.
-
public void binddata() { conn.Open(); OracleCommand cmd = new OracleCommand("SELECT * FROM EMP", conn); OracleDataReader odr = cmd.ExecuteReader(); dt1.TableName = "FXD"; dt1.Load(odr); ds.Tables.Add(dt1); GridView1.DataSource = ds.Tables["FXD"]; GridView1.DataBind(); conn.Close(); } in this way u can bind datatable to gridview..