Codebehind Example Calling Table Data?

Results 1 to 2 of 2

Thread: Codebehind Example Calling Table Data?

  1. #1
    Join Date
    Dec 1969

    Default Codebehind Example Calling Table Data?

    Does anyone have an example using codebehind (in vb) where records are pulled out of a table on the .vb page and used to populate the form on the .aspx page?<BR><BR>All I see are examples where form data from .aspx page is submitted from the .vb page to a table.<BR><BR>Can everything in be done using codebehind? Or is it limited?

  2. #2
    Join Date
    Dec 1969

    Default RE: Codebehind Example Calling Table Data?

    My understanding of CodeBehind is that it&#039;s kind of like COM objects. I said "Kind of"<BR><BR>Imagine in a regular ASP page that you have this:<BR>-a &#060;form&#062;...&#060;/form&#062;<BR>-a &#060;submit&#062; button<BR>-The &#060;submit&#062; button leads you to another .asp page<BR>-in this other .asp you create an instance of your COM object<BR>-You can now use the properties and methods of this object.<BR><BR>Now when I say "kind of" its because all the logic/code is written in that COM object and NOT IN THE .ASP PAGE ITSELF.<BR>So CodeBehind, to me, is similar to this as in:<BR><BR>I write a regular .aspx page with a &#060;form&#062;...&#060;/form&#062; and a couple of buttons. These *buttons* will have an "onclick" attribute that calls a functions or sub. Now instead of writting these Functions and Subs directly in the *same* .aspx page I write then in a .vb file (if VB.NET). Then all I need to do is reference this .vb file into my .aspx page.<BR><BR>You can also think of this as include files in regular .asp pages. It enables you to separate the logic like functions and subs into another file.<BR><BR>--&#062;Can everything in be done using codebehind&#060;--<BR>The way I see it is, can everything be done in COM objects in regular .asp pages ? Now the answer is yes if I want to but the great thing about NOT doing it all in COM objects is that you can edit an .asp page in notepad and add a Response.Write then save the page without having to re-install the COM Object. <BR>So sometimes its better and sometimes its not<BR><BR>In .NET you wont have these problems (about re-installing the dll and stuff) so Yes you can use CodeBehind to do everything for instance:<BR><BR>------------<BR>...reference the .vb file<BR>&#060;html&#062;<BR>&#060;body&#062;<BR><B R>&#060;/body&#062;<BR>&#060;/html&#062;<BR>------------<BR><BR>But the better approach, or microsoft&#039;s approach is to use CodeBehind *only* to separate the logic from the controls. Again, you could create an .aspx file with all the server controls (&#060;asp:button....&#062;) and then reference the .vb file which contains all the code for the "onclick" attribute.<BR><BR><BR>--&#062;is it limited?&#060;--<BR>I don&#039;t know :(<BR><BR>All of the above is my understanding so I could be wrong all the way, if I&#039;m please advise me so I can return the book I bought ;)<BR><BR>Sincerely<BR>Vlince<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts