using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.OleDb;

public partial class WebUserControl : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        

    }
    protected void Texbox1_PreRender(object sender, EventArgs e)
    {
        ViewState["Id"] = Texbox1.Text;
    }
    protected void Texbox3_PreRender(object sender, EventArgs e)
    {
        string select = "SELECT * FROM [Categories] WHERE CategoryID LIKE '" + ViewState["Id"] + "'";
        OleDbConnection conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + Server.MapPath("~/App_Data/Nwind.mdb"));
        OleDbDataAdapter adapter = new OleDbDataAdapter();
        adapter.SelectCommand = new OleDbCommand(select, conn);
        DataTable myDataTable = new DataTable();
        conn.Open();
        try
        {
            adapter.Fill(myDataTable);
        }
        finally
        {
            conn.Close();
        }
        Texbox3.Text = myDataTable.Rows[0]["Description"].ToString();
    }
}
