コード例 #1
0
 protected void SearchItems()
 {
     if (ItemNameDropDownList.SelectedIndex.Equals(0))
     {
         ErrorLabel.Text    = "Select The Valid Item";
         ErrorLabel.Visible = true;
     }
     else
     {
         Query = "select ItemType.name , Items.Quantity , Items.Price , ItemType.ImagePath from ItemType INNER JOIN Items ON ItemType.type_id = Items.Type_id AND Items.Type_id = '" + ItemNameDropDownList.SelectedItem.Value + "'";
         dt    = cc.GetData(Query);
         if (dt.Rows.Count == 0)
         {
             ErrorLabel.Visible    = true;
             ErrorLabel.Text       = "No Data Available";
             ItemsDataList.Visible = false;
         }
         else
         {
             ErrorLabel.Visible       = false;
             ErrorLabel.Text          = "";
             ItemsDataList.Visible    = true;
             ItemsDataList.DataSource = dt;
             ItemsDataList.DataBind();
         }
     }
 }
コード例 #2
0
 protected void SearchItems_Click(object sender, EventArgs e)
 {
     try
     {
         Query = "select ItemType.name , Items.Quantity , Items.Price ,Items.Item_id, ItemType.ImagePath from ItemType INNER JOIN Items ON ItemType.type_id = Items.Type_id AND Items.Type_id = '" + TypeDropDownList.SelectedItem.Value + "'";
         dt    = cc.GetData(Query);
         ItemsDataList.DataSource = dt;
         ItemsDataList.DataBind();
     }
     catch (Exception ex)
     {
         Response.Write(ex.Message);
     }
 }