In ASP>Net using C#, I declared a variable as member of the class as follows:
public class sales: System.Web.UI.Page
{
string type=null;
}
And i have an Image Button in my UI for which I’ve defined the event called
protected void ImageButton2_Click(object sender, ImageClickEventArgs e)
in this method, any value assigned to variable ‘type'(by any other method of the class) is not retained and only value null is being retrieved though I’ve assigned some value to ‘type’ somewhere inside the class…
What could be the problem that I cant access the assigned value????
This is probably a result of the render pipeline. Remember, even though your event is being fired, the page and all variables are recreated with their default value. Create it as a property with at least a backing viewstate storage.