I'm writing an asp.net application with gridview using objectdatasource. There are number if text box fields on the form for the user to search on.
I've setup the objectdatasource with a BLL and select parameters. So it passes 10 parameters, but then I need to pass those 10 parameters to the DAL.
Is there any versatile way to do this rather pass all the variables?what is the Best Practise? Perhaps into an object class?
I suggest you create a class to store these parameters, like this:
public class ParameterClass{
public string para1{get;set;}
public string para2{get;set;}
public string para3{get;set;}
public string para4{get;set;}
public string para5{get;set;}
public string para6{get;set;}
...
}
And then store your parameters to the class instance, like this:
ParameterClass instance = new ParameterClass();
instance.para1 = TxtPara1.Text;
instance.para2 = TxtPara2.Text;
instance.para3 = TxtPara3.Text;
instance.para4 = TxtPara4.Text;
instance.para5 = TxtPara5.Text;
var result = GetResult(instance);
Member
14 Points
51 Posts
Objectdatasource select parameters in n-tier
May 15, 2014 05:58 AM|alphabeatsco|LINK
I've setup the objectdatasource with a BLL and select parameters. So it passes 10 parameters, but then I need to pass those 10 parameters to the DAL.
Is there any versatile way to do this rather pass all the variables?what is the Best Practise? Perhaps into an object class?
Star
12777 Points
1635 Posts
Re: Objectdatasource select parameters in n-tier
May 15, 2014 10:39 PM|Terry Guo - MSFT|LINK
Hi alphabeatsco,
I suggest you create a class to store these parameters, like this:
And then store your parameters to the class instance, like this:
Hope it helps.
Best Regards,
Terry Guo