Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have been an ASP developer for years and am trying to get my arms around ASP.NET. I am trying to call a function from my ASPX file that exists in my VB file. The function makes a call to SQL Server to get a list of records to display. I am trying to do all of the looping in the VB file and just have that information returned to the ASPX file with a Response.Write.

 

I have seen somewhere where the person created the DataReader in the ASPX file and then referenced it from the VB file. This allowed him to loop through the resultset in the ASPX file. I would prefer to do my looping in the ASPX file and return a StringBuilder or a Response.Write or even an HTMLTextWriter.

 

I have also seen where I can create a namespace and do it that way. Again, this just feels too clunky. Maybe this is the best way to do it, but I really don't know.

 

What do you folks do? I would like to see a couple of different suggestions so that I can debate the pros and cons.

 

Thanks in advance!!

Aspnot
Posted

Sending all of the HTML to the browser with something like Response.Write has gone the way of the dodo bird. The whole point of ASP.NET is to be able to put controls (stock or custom) on the web form and then access them programmatically. ASP.NET handles the rest (translating code into HTML).

 

I was probably in the same boat as you are right now. When I first became familiar with ASP.NET, I felt that I was losing some flexibility by relying on this method. Once you get used to this approach though, you will find your overall production increases dramatically.

 

You should be able to find many examples around the site and on MSDN.

Posted

The layout I want is something like

 

Headline Title (a few spaces) Date

 

Text of the abstract goes here. Blah Blah Blah

 

 

There may be up to 5 headlines at any given time. How would I preload the ASP.NET form to be able to handle this? Can I just use a container control and then populate it with the necessary controls at runtime?

 

Just trying to get a grip on this.

 

Thanks!!

Aspnot

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...