I assume that you are using ASP.NET inbuilt ajax support and you want to display the information on a button click event.
The following is a code sample for Button Click Event.
protected void btnShowData_Click(object sender, EventArgs e)
{
SqlCommand cmd = new SqlCommand();
cmd.Connection = connection;
cmd.CommandText = "ap1";
cmd.CommandType = CommandType.StoredProcedure;
#region Parameters
SqlParameter p = new SqlParameter();
p.ParameterName = "@id";
p.Value = "1";
p.SqlDbType = SqlDbType.Int;
cmd.Parameters.Add(p);
#endregion
SqlDataAdapter da = new SqlDataAdapter(cmd);
DataTable dt = new DataTable();
da.Fill(dt);
if (dt.Rows.Count > 0)
{
txtID.Text = dt.Rows[0]["id"];
txtName.Text = dt.Rows[0]["name"];
}
}
Make sure that you are placing the two text boxes and a button in an update panel.