M
MoonWa
I have added a GRidView to my page but have not bound the data yet. How do I
bind my GridView to a SqlDataSource when a user clicks a button. Here is the
code I have but it does not work.
SqlDataSource editDS = new SqlDataSource();
editDS.ID = "editDS";
editDS.ConnectionString =
WebConfigurationManager.ConnectionStrings["collaborativesqlSecureConnectionString"].ConnectionString;
editDS.ProviderName = "System.Data.SqlClient";
editDS.SelectCommand = "SELECT [EventId], [EventDateTime] FROM
[MainEvents] WHERE " + dateStr + " LIKE EventDateTime";
// Bind GridView to data source
eventEditGV.DataSourceID = editDS.ID;
Page.DataBind();
bind my GridView to a SqlDataSource when a user clicks a button. Here is the
code I have but it does not work.
SqlDataSource editDS = new SqlDataSource();
editDS.ID = "editDS";
editDS.ConnectionString =
WebConfigurationManager.ConnectionStrings["collaborativesqlSecureConnectionString"].ConnectionString;
editDS.ProviderName = "System.Data.SqlClient";
editDS.SelectCommand = "SELECT [EventId], [EventDateTime] FROM
[MainEvents] WHERE " + dateStr + " LIKE EventDateTime";
// Bind GridView to data source
eventEditGV.DataSourceID = editDS.ID;
Page.DataBind();