Adeesanan Siva Adeesanan Siva - 25 days ago 14
ASP.NET (C#) Question

How to display a div inside asp.net pageload

I'm trying to visible a div within aspx.cs C# file.here i'm using stored procedure to get the product list with prices.So i defined a div call sizemenu in the aspx page.How can i visible this within the particular function. is there any possible ways?

Product product = new Product();
product.Id =Convert.ToInt64(labl.Text);

Hashtable parameterList = new Hashtable();
parameterList.Add("saleId", index.saleid.Id);//sale id
parameterList.Add("productId", product.Id);
parameterList.Add("productSizeId", null);
parameterList.Add("costPrice", null);
parameterList.Add("salesPrice", null);
//parameterList.Add("offerDetailId", null);
parameterList.Add("offerFound", -1);
parameterList.Add("currentDate", DateTimeUtil.GetFormattedString(((Sale)index.saleid).Date.Date));
parameterList.Add("currentTime", DateTimeUtil.GetFormatedTimeString(Convert.ToDateTime(((Sale)index.saleid).Time)));
parameterList.Add("day", Const.GetDay(((Sale)index.saleid).Date.DayOfWeek));
parameterList.Add("productSizePointValue", null);
parameterList.Add("isOfferUser", "False");
parameterList.Add("recipeSelection", null);
psList.SelectUsingSP(Global.sess, "SqlProInsertProductSizeToSale", parameterList);


if (psList.Count == 0)
{

}
else if (psList.Count == 1)
{

}
else if (psList.Count > 1)
{

//want to display the div here
}

Answer

Take Div in .aspx page

  <div  id="divdisplay" runat="server" visible="false">
    //write your code//or html code
  </div>

in aspx.cs File

divdisplay.visible=false;
 if (psList.Count == 0)
        {

        }
        else if (psList.Count == 1)
        {

        }
        else if (psList.Count > 1)
        {
           divdisplay.visible=true;
           //divdisplay.innerHtml="vcxcvcxvcbvc.......";
           //want to bind html  div from code Behind
        }

above code helps you to make it working.

Comments