In my shopping cart project I have a datalist displaying several products. Certain products are
available in certains seasons only. If an user clicks 'add to cart' button and if that product
does not belong to the current season then I want to show a label stating 'It is off season'
beneath that particular button alone inside the datalist. I tried with the
following code, no display of label is hapenning.
SqlCommand cmd4 = new SqlCommand("SELECT season from product WHERE CategoryId='" + v_categoryid + "' and ProductId='" + v_code + "' and season !='jan-dec'", con);
SqlParameter param4 = new SqlParameter();
param4.ParameterName = "@v_mem_id1";
param4.Value = "ss";
cmd4.Parameters.Add(param4);
con.Open();
SqlDataReader reader1 = cmd4.ExecuteReader();
if (reader1.HasRows)
{
while (reader1.Read())
{
string v_season = reader1.GetString(0);
Label11.Text = "check season";
Label11.Visible = true;
<asp:TextBox ID="AddToCartTB" runat = "server" Text='1' BackColor=GhostWhite style=" margin-left:11px" Width="34px" > </asp:TextBox>
<asp:Button ID="AddToCart" runat = "server" Text='Add to Cart' ForeColor="#333333" BackColor="#ffcc66" Width="100px" Style=" margin-top:-22px; margin-left:100px; font-family:Arial" commandname="myevent">
</asp:Button>
<asp:Label ID="Label11" runat = "server" Text="" style=" color: Silver">
</asp:Label>