By Pertti Karjalainen - 12/5/2006
I have tried to study and follow the SF VB web sample project, but since I am using C# and am kinda new to Strataframe and there seems to be no actual documentation on how to do this stuff step by step, I would like to know how one goes about setting up a web application, or at least the basic "infrastructure" of it (basepage, CSS, etc.) Step-by-step instructions would be great.I assume Business Objects and the BO functionality are exactly the same between web and windows apps, no? Pertti
|
By Pertti Karjalainen - 12/5/2006
OK, I can't get anywhere with my web application efforts without some help from you guys. I see no web templates when I try to create a new web site, I have no clue as to how to even begin to go about this. Could be that I am locked in the MM.NET mindset. Could be that my installation is not complete. Could be that some documentation would help. FYI, I am able to create Windows apps following the videos, but web apps with strataframe are a blank page for me.So, call me clueless...
|
By Trent L. Taylor - 12/5/2006
You are going to want to create a new WebSite instead of a new project and you will see the template.- Open VS2005
- Click File -> New -> Website
This will present the following screen - Make sure that you choose your desired langauge (C# in this case)
- Name your website and then click OK
- This will create the basic structure of a website.
- Next, you are going to want to add another project to your solution (if you do not already have one) which is your Business Object Library. DO NOT CREATE business objects within the web site, this will just cause you some frustrations as ASP.NET projects treat components differently that a class library project.
- To add a new class library, right click the solution and then click Add -> New Project.
- Open the C# -> StrataFrame options on the left and then choose a BO class library project
- Name the project to your liking and then click OK.
- Delete the existing BO (Businessobject1) and add your first BO to the library (right-click on the BO project and then click Add -> New Item and then select the SF Business Object.
- Once you have your class library setup, you will need to add a reference to the website so it can see the business objects. To do this, right-click the website project and then go to Add Reference.
- You can now reference BOs in your website.
- To add a website BO, you will open up a base page (at this point you will only have one). Under the App_Code folder open the ApplicationBasepage.cs file. You will see a region here called Business Object Declarations. This is where you will declare your BO. Any page that inherits this base page will then be able to see and bind to that BO. Below is a sample BO declaration, it is slightly different in C# than VB.Net and requires that a property be created. Once this is done you will be able to bind just as though in a WinForm. Note: You may need to build your solution before this step.
private SampleBOLibrary.CustomersBO _Customers; public SampleBOLibrary.CustomersBO Customers { get { return _Customers; } set { _Customers = value; } } - Open up the Default.aspx page and drop on a StrataFrame text box.
- Go to the BusinessObjectName property and set it to your BO (Customers in this case)
- Next, select the binding field on the BindingField property.
Business Objects To learn more about the BO Mapper go through the WinForms tutorial, even though the help is for VB, I am confident that you will able to work through the sample in C#. The BOs are the exact same for web as they are for WinForms. Additionally, there is a lot of documentation as it relates to the BO Mapper and the business objects. This should get you going in this department. Obviously you can post any questions you have in regards to this on the forum. Note: Attached is the sample I created to write this post.
|
By Pertti Karjalainen - 12/5/2006
Unfortunately I don't see those templates when I open a new website. I wonder if my Visual Studio 2005 installation is hosed... This is what I see:
|
By Trent L. Taylor - 12/5/2006
Well, I have never seen the SF Windows templates in that view. It appears that the Windows Forms templates are in your web folder. How this happened I have no idea. Look in the following location:C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\ProjectTemplates\Web\CSharp You should have a zip file in this folder named SF_WebApplication.zip. If you do, the close all of your Visual Studio instances and type the following command in the "run" window or at the command prompt: "C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\devenv.exe" /setup Go back into VS2005 and see if the template then exists. If not we will have to dig a little deeper.
|
By Pertti Karjalainen - 12/6/2006
That did the trick!And thanks for the step-by-step, because of which I now have my first dinky Strataframe -based website up and running (against VFP data, nevertheless). Where did I put that bottle of Dom Perignon now... Oh, I forgot, I think I drank it last night about 2 am out of frustration... How many times does one have to feel like a grunt and a beginner yet again in one's life? To me this is time number 130,245... But, hey, maybe it's just one way to keep the old man Alzheimer at bay Pertti
|
By StrataFrame Team - 12/6/2006
That is certainly one way to look at it And, yes, in the IT industry, there is something new to learn every day.
|
By Pertti Karjalainen - 12/6/2006
Well, I managed to brake something on my dinky website, and it is probably something very simple and my mistake. But I can't figure it out. I followed the step by step above, but when I tried to set a breakpoint at my default page on_load event where I load data. However, the debugger it never stops there, it acts as if the page load code never even executes. As a result the data field on the browser window doesn't get populated. I can set a breakpoint at page_load in your VB Web sample app just fine, of course...Below are pictures of my dev. environment at the breakpoint as well as the browser window. Any help would be appreciated. By me... Code:
Solution Explorer: web page:
|
By StrataFrame Team - 12/7/2006
With VB, there is a little "Handles" keyword at the end of an event handler that tells the compiler to add the handler to the event. However, within C#, there is no such thing... it must be done within the designer file. Your best be would be to open the page and go to the Design view where you can visually build the page. View the property sheet for the page and you will see a button at the top of the property sheet that will show you the events. In the Load event, you need to type the name of your method that is handling the load event.I think you can also add the code within the page directive within the markup file... but I'm not sure.
|
By Pertti Karjalainen - 12/7/2006
Ben:Since this is an ASP app I don't have access to events from the property sheet... I tried all kinds of things with the base page and my default page, but the debugger just won't cooperate, which means the page load code doesn't run for some god-awful reason... Would it be possible to see a complete C# web app all the way through databinding etc. and to a ready-to-run project. The step-by-step instructions above stopped short of that kind of completion, and I suppose I am not the only one struggling with the C# web apps using StrataFrame, since there is no walk-throughs for that. The VB web sample walkthrough is great, but given the differences between the two languages it isn't all that much help when trying to get a sample app up and running in C#. I feel like I'm spinning my wheels unnecessarily here because of the lack of C# tutorials/walkthroughs. Thank you! Pertti Ben Chase (12/07/2006)
With VB, there is a little "Handles" keyword at the end of an event handler that tells the compiler to add the handler to the event. However, within C#, there is no such thing... it must be done within the designer file. Your best be would be to open the page and go to the Design view where you can visually build the page. View the property sheet for the page and you will see a button at the top of the property sheet that will show you the events. In the Load event, you need to type the name of your method that is handling the load event. I think you can also add the code within the page directive within the markup file... but I'm not sure.
|
By Trent L. Taylor - 12/7/2006
We are in the process of converting all of our VB samples to C#. These will all be included in the next update, but we will post them on the forum as they come available. We will move the website sample up on the list and we will let you know when it is available on the forum. This should get you going. Thanks.
|
By Pertti Karjalainen - 12/7/2006
Thanks! This will be most helpful. As soon as possible, if there was even a quick and simple example on creating a C# web project from the beginning to the end with setup, databinding and up the the finished application that we could actually run on our computers and study the code & settings, that would be great.Can't wait... Pertti
|
By Trent L. Taylor - 12/7/2006
The C# sample is the same as the VB, but just in C# code. So this should give you plenty to look at to get you going.
|
By Pertti Karjalainen - 12/7/2006
Well, maybe it's just me, but I can't get the C# clone of the VB app going. Doesn't populate the controls on my web page, although it doesn't throw any errors, either. Nor does the debugger seem to step through the code where population is supposed to happen. Dunno.Pertt
|
By Trent L. Taylor - 12/7/2006
Pertti,Below is a link to the CSharp web sample that has been converted from the VB.Net web sample. This should give you more than enough to see how to layout a StrataFrame web site. I hope this gets you going http://forum.strataframe.net/FindPost5109.aspx
|
By Pertti Karjalainen - 12/7/2006
Gracias, Amigo!Burning some midnight oil, I see... But, hey, might as well be part of the biggest club in the world . Gives a whole new meaning to "clubbing", too... Thanks again -- this will take me much further on my journey into the new StrataSpeheres... Pertti
|
By Trent L. Taylor - 12/8/2006
Yeah...I've actually been a member of that "club" for quite a while now....I just keep learning what a big club that it is . Anyway, I am glad to help
|