i have found lots of tutorials on seperating the data access layer but couldnt find any on seperating the presentation layer...what i require is something like this.
i have a page testPage.aspx
<asp:datagrid ...>formatting of data here</asp:datagrid>
<asp:label></asp:label>
and more...
and in code behind i have:
------------------
string strsql = "select * from tbl_name";
dataset ds = test.dal.executeds(strsql);
datagrid.datasource = ds
datagrid.databind()
some more binding and formatting
------------------
presentation layer
application layer
business logic layer - i got this sorted as well
data access layer - using microsoft dal
how do i elimate 'string strsql' in codebehind so no sql stuff is done in codebehind...and also i want to render testPage to a format thats specified in a xml file, so if xml file changes rendering changes without having to recompile the project.
any suggestions would be very much appriciated
thanksHi,
say you have these 3 layers named : webui, br, dal.
So in your code behind you would call the business rules:
dataset ds = br.getmydata();
datagrid.datasource = ds;
datagrid.databind();
In your business you typically do some checking:
so in your method getmydata() you can write something like this:
return new dal.getmydata();
and in your dal you can finally write something like this in your dal's method getmydata:
string strsql = "select * from tbl_name";
... do the rest of your data retrieval here and return your dataset.
For your other question: I believe Microsoft's using something like mspx for this.
Grz, Kris.
0 comments:
Post a Comment