Hello..
i have one datalist.i use label1 in my .net design page index.aspx i write the code in index.aspx.cs page.
string name = Label1.Text.Trim();
Session["name"] = name;
but Label1.Text error show "The name 'Label1' does not exits in the current context"
This stupid problem lost my 2 day.
Please solution provide me..


Manas MohapatraRank #182 · 13.2K reputationPosted Aug 31, 2015, 10:35 PM EDT
Prashant Malav37 reputationPosted Aug 31, 2015, 11:02 PM EDT
Ranjit PowarRank #553 · 4.4K reputationPosted Aug 31, 2015, 11:08 PM EDT
Manas MohapatraRank #182 · 13.2K reputationPosted Aug 31, 2015, 11:13 PM EDT
Raja TRank #685 · 3.5K reputationPosted Aug 31, 2015, 11:13 PM EDT
Khan Abrar AhmedRank #778 · 3K reputationPosted Sep 1, 2015, 3:50 AM EDT
Rahul PrajapatRank #1,209 · 1.5K reputationPosted Sep 1, 2015, 3:54 AM EDT
{
string name = ((Label)(DataList1.Items[e.Item.ItemIndex].FindControl("Label1"))).Text.Trim();
Session["name"] = name;
}