1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
|
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
try
{
string cod = Request.QueryString["codcat"];
int codint = 0;
if (Int32.TryParse(cod, out codint))
{
RecupererListeArticle(cod);
}
else
{
//Todo: afficher un message d'erreur
}
}
catch (Exception)
{
//Todo: afficher un message d'erreur
}
}
}
private void RecupererListeArticle(string codeArticle)
{
SqlDataSource1.SelectCommand="SELECT nom_article FROM article WHERE nom_article = @codeArticle";
SqlDataSource1.SelectParameters.Add("@codeArticle", System.Data.DbType.Int32, codeArticle);
DropDownList1.DataSource = SqlDataSource1;
DropDownList1.DataBind();
} |