Reputation: 18906
how can i access the my sqldatasource selected datasource for modification and adding for example new datacolumns before binding??
where is the best place to perform these modifications ?
I guess SqlDataSource1_Selected is the right place, but i don't know how ?
----------updated---------
I found how to to access the selected data to show the total record but my questions is still not solved
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DataTable dt = ((DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty)).Table;
LabelTotal.Text = string.Format("{0} items found", dt.Rows.Count);
}
}
Upvotes: 2
Views: 1652
Reputation: 11311
It will be better if you bind GridView
using your custom code at .cs page rather than use SqlDataSource.
At .cs page you can perform your operation with datatable
before bind gridview
.
Upvotes: 2