Home  »  Forum  »  ASP.Net  »

How to use in datalist control for itemdatabound?

 Posted By : chandru MPosted Date : 24/08/2011 12:36:36 PM Category : ASP.Net Points : 1

Dear all

        datalist control using itemdatabound how to using in session values..

 

Advance Thanks to all

Responses
 Author : Manoranjan Sahoo Member Level : BronzeDate : 24/08/2011 02:53:36 PM Points : 1

Hi,

can you please explain doubt in details?

actually i am not getting your point.



 Author : chandru M Member Level : BronzeDate : 24/08/2011 03:34:24 PM Points : 1

hi,

protected void DataList3_ItemDataBound(object sender, DataListItemEventArgs e)
    {
     
         ( e.Item.ItemType == ListItemType.Item ||
         e.Item.ItemType == ListItemType.Separator )
        {
            Label lblprodName = (Label)e.Item.FindControl("lblprodName");
            Session["lblprodName"] = lblprodName.Text;
      
    }

am using this coding. but display for static. i want dynamic display.



 Author : Manoranjan Sahoo Member Level : BronzeDate : 14/10/2011 06:31:50 AM Points : 3

can you tell me with some example? what you exactly want and what it display?
try below code :
In page_load event use below code

DataList3.ItemDataBound += new DataListItemEventHandler(this.Item_Bound);


and below page_load event use below method.

void Item_Bound(Object sender, DataListItemEventArgs e){    if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) {      Label ProductName = (Label)e.Item.FindControl("lblprodName"); HttpContext.Current.Session["lblprodName"] = ProductName.Text;         }}

 



Post Reply
Login to post Response.