By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
449,423 Members | 1,294 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 449,423 IT Pros & Developers. It's quick & easy.

Questions about asp 3.0 and aspnet's differences

P: n/a
Hi, i have decent experience with asp 3.0 (classic), and downloaded web
developer express to see what's the fuzz over it. I have lots of
questions, mostly regarding the use of forms and database use.

1) Why should i use the asp:label, asp:textbox, asp:submit instead of
plain old html input type="...", form action="..."

2) What's up with all those javascript:__dopostback links when using
some controls? Does it mean text browsers and such couldn't use the
site?

3) Code-behind files. Can i use code-behind files when posting to the
same page? I have some pages on asp 3.0 that are like this:

example.asp

<%if request.form="" then%>
Enter your login and password (show input and submit, post to the same
page)
<%else%>
<connect to database, if successfull show links or other stuff, else
redirect to error page
<%end if

I wouldn't know how to use code behind files for that behaviour, since
i wouldn't know how to insert the "if not ispostback.. then... end if"
code and printing the bunch of labels...

My guess is that i should only use code behind files if posting to a
different page.

4) How to do database queries programatically?

In asp 3, i had this code:

set conn= server.createobject("adodb.connection")
conn.open application("connectionstring")
sql="select * from something"
set rs=conn.execute(sql)
if not rs.eof then
<table>
do while not rs.eof
<tr><td><%=rs(0)%></td></tr>
rs.movenext
loop
rs.close
set rs=nothing
conn.close
set conn=nothing

in asp.net, i have ported that code to this:

Dim dbconn = New
SqlConnection(ConfigurationManager.ConnectionStrin gs("ConnectionString").ConnectionString)

dbconn.open()
Dim sql = "select * from something"
Dim dbcomm = New SqlCommand(sql, dbconn)
Dim dbread = dbcomm.executeReader()
customers.DataSource = dbread
customers.DataBind()
%>
<asp:Repeater id="customers" runat="server">

<HeaderTemplate>
<table border="1" width="100%">
<tr bgcolor="#b0c4de">
<th>id</th>
</tr>
</HeaderTemplate>

<ItemTemplate>
<tr bgcolor="#f0f0f0">
<td><%#Container.DataItem("id")%</td>
</tr>
</ItemTemplate>

<FooterTemplate>
</table>
</FooterTemplate>

</asp:Repeater>
<%dbread.Close()
dbconn.Close()

I need way too more code in asp net to do what i do in asp classic. For
the record, i have used the new controls that you just drag and drop
and you just modify the sql and parameters. Am i using the proper way
to do this in aspnet programatically?

5) If i migrate to asp net, i would like to have almost all code in the
code behind files, and use the aspx files mainly as templates. The code
in 4) is far from this. Is there a way to do this cleanly ? I can't see
myself loosing my ties with the old form of development, it may be
messy but it is very flexible.

6) THe new login controls. How do they work by default? I have a
"dummies" book and it says that it creates a database by default for
the users. I went to the asp configuration pages and created some
users, but don't see where those users are getting stored. The book
says i can implement a membership provider by implementing a class. I
guess that is powerful but a little cumbersome comparing to having a
username and password being asked, reading the values, doing a query
with them and reacting for the result.

All right, i can't think of anything else for now. Thanks in advance

Aug 13 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Seguros,
Rather than spending lots of time going back and forth in the group over all
your questions, since you are just starting out, I'd recommend that you
invest an hour or so working your way through the ASP.NET QUICKSTART. This is
online at the asp.net site, and they've really invested a tremendous amount
of effort in providing explanations and examples of how most everything you
could ask about ASP.NET works. Trust me: It can save you weeks of time.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Seguros Catatumbo" wrote:
Hi, i have decent experience with asp 3.0 (classic), and downloaded web
developer express to see what's the fuzz over it. I have lots of
questions, mostly regarding the use of forms and database use.

1) Why should i use the asp:label, asp:textbox, asp:submit instead of
plain old html input type="...", form action="..."

2) What's up with all those javascript:__dopostback links when using
some controls? Does it mean text browsers and such couldn't use the
site?

3) Code-behind files. Can i use code-behind files when posting to the
same page? I have some pages on asp 3.0 that are like this:

example.asp

<%if request.form="" then%>
Enter your login and password (show input and submit, post to the same
page)
<%else%>
<connect to database, if successfull show links or other stuff, else
redirect to error page
<%end if

I wouldn't know how to use code behind files for that behaviour, since
i wouldn't know how to insert the "if not ispostback.. then... end if"
code and printing the bunch of labels...

My guess is that i should only use code behind files if posting to a
different page.

4) How to do database queries programatically?

In asp 3, i had this code:

set conn= server.createobject("adodb.connection")
conn.open application("connectionstring")
sql="select * from something"
set rs=conn.execute(sql)
if not rs.eof then
<table>
do while not rs.eof
<tr><td><%=rs(0)%></td></tr>
rs.movenext
loop
rs.close
set rs=nothing
conn.close
set conn=nothing

in asp.net, i have ported that code to this:

Dim dbconn = New
SqlConnection(ConfigurationManager.ConnectionStrin gs("ConnectionString").ConnectionString)

dbconn.open()
Dim sql = "select * from something"
Dim dbcomm = New SqlCommand(sql, dbconn)
Dim dbread = dbcomm.executeReader()
customers.DataSource = dbread
customers.DataBind()
%>
<asp:Repeater id="customers" runat="server">

<HeaderTemplate>
<table border="1" width="100%">
<tr bgcolor="#b0c4de">
<th>id</th>
</tr>
</HeaderTemplate>

<ItemTemplate>
<tr bgcolor="#f0f0f0">
<td><%#Container.DataItem("id")%</td>
</tr>
</ItemTemplate>

<FooterTemplate>
</table>
</FooterTemplate>

</asp:Repeater>
<%dbread.Close()
dbconn.Close()

I need way too more code in asp net to do what i do in asp classic. For
the record, i have used the new controls that you just drag and drop
and you just modify the sql and parameters. Am i using the proper way
to do this in aspnet programatically?

5) If i migrate to asp net, i would like to have almost all code in the
code behind files, and use the aspx files mainly as templates. The code
in 4) is far from this. Is there a way to do this cleanly ? I can't see
myself loosing my ties with the old form of development, it may be
messy but it is very flexible.

6) THe new login controls. How do they work by default? I have a
"dummies" book and it says that it creates a database by default for
the users. I went to the asp configuration pages and created some
users, but don't see where those users are getting stored. The book
says i can implement a membership provider by implementing a class. I
guess that is powerful but a little cumbersome comparing to having a
username and password being asked, reading the values, doing a query
with them and reacting for the result.

All right, i can't think of anything else for now. Thanks in advance

Aug 13 '06 #2

P: n/a
THe first tip i would give you is forget absolutely everything you learned to
program in classic asp. asp.net and classic asp are so different i
personally beleive it is easier to learn asp.net having never programmed
before than it is to learn it after having lots of experience with classic
asp. classic ASP is much closer to PHP than it is to asp.net. asp.net is
more like programming windows forms applications than it is like classic asp.

"Seguros Catatumbo" wrote:
Hi, i have decent experience with asp 3.0 (classic), and downloaded web
developer express to see what's the fuzz over it. I have lots of
questions, mostly regarding the use of forms and database use.

1) Why should i use the asp:label, asp:textbox, asp:submit instead of
plain old html input type="...", form action="..."

2) What's up with all those javascript:__dopostback links when using
some controls? Does it mean text browsers and such couldn't use the
site?

3) Code-behind files. Can i use code-behind files when posting to the
same page? I have some pages on asp 3.0 that are like this:

example.asp

<%if request.form="" then%>
Enter your login and password (show input and submit, post to the same
page)
<%else%>
<connect to database, if successfull show links or other stuff, else
redirect to error page
<%end if

I wouldn't know how to use code behind files for that behaviour, since
i wouldn't know how to insert the "if not ispostback.. then... end if"
code and printing the bunch of labels...

My guess is that i should only use code behind files if posting to a
different page.

4) How to do database queries programatically?

In asp 3, i had this code:

set conn= server.createobject("adodb.connection")
conn.open application("connectionstring")
sql="select * from something"
set rs=conn.execute(sql)
if not rs.eof then
<table>
do while not rs.eof
<tr><td><%=rs(0)%></td></tr>
rs.movenext
loop
rs.close
set rs=nothing
conn.close
set conn=nothing

in asp.net, i have ported that code to this:

Dim dbconn = New
SqlConnection(ConfigurationManager.ConnectionStrin gs("ConnectionString").ConnectionString)

dbconn.open()
Dim sql = "select * from something"
Dim dbcomm = New SqlCommand(sql, dbconn)
Dim dbread = dbcomm.executeReader()
customers.DataSource = dbread
customers.DataBind()
%>
<asp:Repeater id="customers" runat="server">

<HeaderTemplate>
<table border="1" width="100%">
<tr bgcolor="#b0c4de">
<th>id</th>
</tr>
</HeaderTemplate>

<ItemTemplate>
<tr bgcolor="#f0f0f0">
<td><%#Container.DataItem("id")%</td>
</tr>
</ItemTemplate>

<FooterTemplate>
</table>
</FooterTemplate>

</asp:Repeater>
<%dbread.Close()
dbconn.Close()

I need way too more code in asp net to do what i do in asp classic. For
the record, i have used the new controls that you just drag and drop
and you just modify the sql and parameters. Am i using the proper way
to do this in aspnet programatically?

5) If i migrate to asp net, i would like to have almost all code in the
code behind files, and use the aspx files mainly as templates. The code
in 4) is far from this. Is there a way to do this cleanly ? I can't see
myself loosing my ties with the old form of development, it may be
messy but it is very flexible.

6) THe new login controls. How do they work by default? I have a
"dummies" book and it says that it creates a database by default for
the users. I went to the asp configuration pages and created some
users, but don't see where those users are getting stored. The book
says i can implement a membership provider by implementing a class. I
guess that is powerful but a little cumbersome comparing to having a
username and password being asked, reading the values, doing a query
with them and reacting for the result.

All right, i can't think of anything else for now. Thanks in advance

Aug 14 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.