Anyone know how to actually filter a gridview that is based on a datable (which datatable is based on sql data source)?
This is how my gridview works:
The gridview is dynamically created based on inputted data source, database name, and table name
asp:TextBox ID="server_tb" runat="server"
asp:TextBox ID="user_tb" runat="server"
asp:TextBox ID="pswrd_tb" runat="server" TextMode="Password"
asp:TextBox ID="database_tb" runat="server"
asp:TextBox ID="table_tb" runat="server"
Using the input I called the correct table from database and then populated it into datatable
DataTable Table = new DataTable();
Connection = new System.Data.SqlClient.SqlConnection("Data Source=" + ServerName + ";Initial Catalog=" + DatabaseName + ";User ID=" + UserName + ";Password=" + Password + "; Connect Timeout=120");
I bind datatable and dynamically created button template into the gridview together (button template is to allow editing, adding, and deleting)
gvGridView.Columns.Add(ItemTmpField);
vGridView.DataSource = Table;
gvGridView.DataBind();
This is how basically I roughly created my GridView, the code is working well. Basically all I need is to allow filtering on it only. And I could really used some advices on this.