Any code example please?
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
Bind();
}
}
private void Bind()
{
string connectionString =
WebConfigurationManager.ConnectionStrings["Northwind"].ConnectionString;
string selectSQL ="SELECT ProductID, ProductName, UnitPrice FROM Products";
SqlConnection con = new SqlConnection(connectionString);
SqlCommand cmd = new SqlCommand(selectSQL, con);
SqlDataAdapter adapter = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
adapter.Fill(ds, "Products");
GridView1.DataSource = ds;
GridView1.DataBind();
}
private void Button1_click(Object sender,EventArgs e)
{
Bind();
}
source[
^]