Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SSI Issues

Status
Not open for further replies.

gagz

Programmer
Nov 21, 2002
333
US
I used to use <!--#include virtual=&quot;blah.asp&quot;--> to reuse code. In particular, I have some controls on a web page for a search form (countries, states, etc) that are the same all the time. My thought was to use the same method i used to (of course aspx now) and have the included file print the dropdownlist (taken from SQL). So, say, in countries.aspx, i have it read the data from the sql server, and generate and asp:dropdownlist, and asp:listitems for all the countries. I did this, included the file, and called the function. It worked in so much as it printed my entries, but it didn't compile the asp:dropdownlist to be a selectbox in the browser... so what i don't know is if I just changed the included file to print a select box, and not an asp:dropdownlist. How would that affect the runat=server aspect of it, etc.

thoughts?

THANKS.
 
Rather than using an include in your aspx file you should build a User control and include that in your aspx file. Should you want to set any options or properties before the control is shown you will need to code some properties into the control then set them in your code behind file.

Hope that points you in the right direction. That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
I've got most of that working.

my ascx file has a sub routine that does the dirty work... after my end sub i try to call the routing, and it craps out. any idea?
 
After your end sub? Which one?

What do you mean by routing?

What do you mean by craps out? Error msg? Irregular behaviour? That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
yeah, sorry for the poor verbage...

I meant routine, not routing... I don't know why my fingers do that all the time.

Basically my ascx file has

Sub dostuff
'do sql call, add items to ddl
End Sub

dostuff()

and that didn't work.

I don't know why it didn't work... but I just put the sub call in a Page_Load subroutine and it worked fine...

the error it kept give was 'declaration expected'

sorry for the confusion!
 
It didn't work because everything needs to be put inside some sort of event handler so that it knows when it needs to run. When you put the call into the page_load then the program knew when it needed to call that sub.. on the page_load.
From what you wrote I am assuming that it works now and this is now a closed thread. That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
yep seems to be working pretty well... just seemed weird to have potentially two 'page_Load' event handlers... Thanks for all the help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top