Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

Modifying the SqlDataSource of a GridView in C# code behind...

$
0
0
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace mrbeaches.Protected
{
    public partial class WebForm1 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
        {
            ClientScript.RegisterStartupScript(this.GetType(), "myalert", "alert('" + "AlertSepy!" + "');", true);
        }

        protected void TextBox1_TextChanged(object sender, EventArgs e)
        {
            SqlDataSource1.SelectCommand = "SELECT [id], [first], [last], [address1], [address2], [city], [state], [cell], [email], [zip], [phone] FROM [customers] WHERE [first] LIKE \"er%\"";
        }


    }
}

The SqlDataSource1 is bound to the GridView and tested to return data. Changing text inside the box does not yet seem to have any effect on the GridView is there something missing?

Thank You!


Viewing all articles
Browse latest Browse all 23244

Trending Articles