forum

Home / DeveloperSection / Forums / How to access the variable globally?

How to access the variable globally?

Anonymous User181113-Nov-2014

I have a few code lines like this,

public void rt_changed(object sender, AjaxControlToolkit.RatingEventArgs e)
{
    //Label l = sender as Label;
    foreach (DataListItem li in datalist.Items)
    {
 
      Label l = li.FindControl("nl") as Label;
 
    }
    Label3.Text = l.ToString(); // l values is not getting
 }

Here the variable l is null. I know it's happening because the declaration of l has been made inside the scope of the foreach. I don't know how to call the variable with a value in globally.


Updated on 14-Nov-2014
I am a content writter !

Can you answer this question?


Answer

1 Answers

Liked By