B
b_naick
I have a class file in my ASP .NET C# application - defined as follows:
namespace ABC {
public class BizObj {
public Style GetVal(int id) {
Style temp = new Style();
// run some db queries
temp.theName = reader["firstName"].toString();
return temp;
}
}
public class Style {
public string theName;
}
}
In the code behind of my aspx page, I do the following:
Style style = new Style();
BizObj bizobj = new BizObj();
style = bizObj.GetVal(1);
somelabel.text = style.theName;
When I compile and access my page, I get the following error :
Object reference not set to an instance of an object
The line number it refers to is where I set the label's text field.
When i hard code a value (somelabel.text = "Hello"
it works fine. Any
ideas??
namespace ABC {
public class BizObj {
public Style GetVal(int id) {
Style temp = new Style();
// run some db queries
temp.theName = reader["firstName"].toString();
return temp;
}
}
public class Style {
public string theName;
}
}
In the code behind of my aspx page, I do the following:
Style style = new Style();
BizObj bizobj = new BizObj();
style = bizObj.GetVal(1);
somelabel.text = style.theName;
When I compile and access my page, I get the following error :
Object reference not set to an instance of an object
The line number it refers to is where I set the label's text field.
When i hard code a value (somelabel.text = "Hello"

ideas??