CodeVerge.Net Beta


   Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums




Can Reply:  No Members Can Edit: No Online: Yes
Zone: > Asp.Net Forum > general_asp.net.getting_started Tags:
Item Type: Date Entered: 1/13/2007 4:24:06 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 28 Views: 21 Favorited: 0 Favorite
29 Items, 2 Pages 1 2 |< << Go >> >|
"Mainship" <>
NewsGroup User
Need a good tutorial on ASP.NET 2.0 code behind1/13/2007 4:24:06 AM

0

I'm coming straight from Classic ASP and need help with understanding how to use code behind.  At the moment, I'm working with a repeater controls on several pages.  I'm stuck on every page with trying to pass information to and from the code behind.  On one page I need to display different text depending on the value of a database field, if it's true or false.  On another, I'm trying to see if a file exists, and to display a graphic if it does.  In each case, I can solve the problem if I can read and set a label's text from the code behind function or sub. 

The tutorial, or if you can recomend more than one, at least one tutorial must be real basic. 

Thanks!

Diane

"TOMCIO" <>
NewsGroup User
Re: Need a good tutorial on ASP.NET 2.0 code behind1/13/2007 5:53:39 PM

0

1) ASP.NET Unleashed VERY good

2) there is a lot of help , tutorials here:
http://quickstarts.asp.net/QuickStartv20/aspnet/Default.aspx

3) and buy member ship at http://www.learnvisualstudio.net/ - they have tons of very good videos for everyone. I have lifetime membership with them for few years now & i always find something interseting there


Tom | NMGroup.net
1&1 Hosting | WebHost4life | CrystalTech
"ldechent" <>
NewsGroup User
Re: Need a good tutorial on ASP.NET 2.0 code behind1/13/2007 6:05:00 PM

0

Diane:

 Are you using Visual Web Developer 2005 Express Edition to build your code?

The reason I ask, I started out writing code from examples, and people here steered me to VWD 2005 EE.  I find it very similar to Dreamweaver, and I like it because you can work with the code if you like, but with things like textboxes and buttons it is convenient to drag and drop.

The answer above covers your question for finding a tutorial.  If there is something you want to do specifically to get started with code behind, feel free to ask.  I think that is a question many new people coming here would want to see.

-Larry


Start with something simple that works.
"Mainship" <>
NewsGroup User
Re: Need a good tutorial on ASP.NET 2.0 code behind1/13/2007 7:03:03 PM

0

Thank you Tom, Larry.

I'm using Visual Studion 2005 Enterprise, the 90 day evaluation edition.  I plan on buying it when the evaluation period is up.  I'll be wting VB apps as well, so I should probablt get used to using it.

I do have a lifetime membership to LearnVisualStudio.net.  Looks like I'll have to back and take a look at what they have.  I've also bookmarked and have been looking at http://quickstarts.asp.net/QuickStartv20/aspnet/Default.aspx.  The focus still seems to be on the controls.  There's a lot to know about functions, subs, passing data between the code and the controls, etc.  I was hoping there was a good explanation for beginners somewhere that focuses on these topics.

Diane

"TOMCIO" <>
NewsGroup User
Re: Need a good tutorial on ASP.NET 2.0 code behind1/13/2007 10:07:42 PM

0

 ASP.NET Unleashed - very, very good book - take a look at it
Tom | NMGroup.net
1&1 Hosting | WebHost4life | CrystalTech
"Mainship" <>
NewsGroup User
Re: Need a good tutorial on ASP.NET 2.0 code behind1/13/2007 10:22:54 PM

0

Thank you.  Who publishes. it?

Diane

"ldechent" <>
NewsGroup User
Re: Need a good tutorial on ASP.NET 2.0 code behind1/13/2007 10:29:03 PM

0

Mainship:

 On one page I need to display different text depending on the value of a database field, if it's true or false.

For this one, would that be that you have built a database with a series of fields, and you want to print out a list that has the first and last name of every person who has a yes value (or true) for a given category?

 -Larry


Start with something simple that works.
"Mainship" <>
NewsGroup User
Re: Need a good tutorial on ASP.NET 2.0 code behind1/13/2007 11:02:44 PM

0

Not exactly.  I'm printing out the names and other information including a date for everyone who satisfies a particular condition.  That part is handled in the select statement.  One of the fields I'm printing, NewAd is a date.  Another field, ReNewAd in a Boolean.  If ReNewAd is true, I want to print "Change to " before printing the date in the NewAd field.  If RenewAd is false, nothing is printed in front of the date.

So new ads look like "Ad Posted on 1/7/2007" but modified ads look like
"Change to Ad Posted on 1/7/2007"

DIane

"ldechent" <>
NewsGroup User
Re: Need a good tutorial on ASP.NET 2.0 code behind1/13/2007 11:29:24 PM

0

Have you tried any work with the following items in the toolbox: SqlDataSource, Gridview?

I'm not sure where you are at with respect to the SQL part of it (or what database you are using.)  I'm sort of taking this on as a challenge to see if I can do it.  Have you had a chance to look at Bob Tabor's video's yet?  T'hat's where I learned about working with the above mentioned items in the toolbox of VWD 2005 EE.

-Larry


Start with something simple that works.
"Mainship" <>
NewsGroup User
Re: Need a good tutorial on ASP.NET 2.0 code behind1/14/2007 12:11:02 AM

0

I'm using the SqlDataSource, but not the Gridview yet.  I am planning on it though.

Diane

"TOMCIO" <>
NewsGroup User
Re: Need a good tutorial on ASP.NET 2.0 code behind1/14/2007 3:55:29 AM

0

"TOMCIO" <>
NewsGroup User
Re: Need a good tutorial on ASP.NET 2.0 code behind1/14/2007 4:03:31 AM

0

it is very easy. in code behind:

Public Function IsNewAd(ByVal ReNewAd As Boolean) As String

Dim AdDate As String

If stan = True Then

AdDate = "change to "

Else

AdDate=

"whatever shoul be here"

End If

Return AdDate

End Function

In HTML code :

<

asp:label ID="label1" runat="server" text='<%# IsNewAd(eval("ReNewAd"))%>' />

 

 


Tom | NMGroup.net
1&1 Hosting | WebHost4life | CrystalTech
"TOMCIO" <>
NewsGroup User
Re: Need a good tutorial on ASP.NET 2.0 code behind1/14/2007 4:10:42 AM

0

sorry i found error , change

If stan = True

to

If ReNewAd = True


Tom | NMGroup.net
1&1 Hosting | WebHost4life | CrystalTech
"Mainship" <>
NewsGroup User
Re: Need a good tutorial on ASP.NET 2.0 code behind1/17/2007 3:34:58 PM

0

Tom,

I solved the specific problem I had with ReNewAd.  However, that involved the code behind for a repeater control.  It went on the code behind for the page the control was on, and with a couple of clicks, the sub was dropped in for me.  The coding inside was more of a challenge, but with a lot of help, I now have that working.

What I need to do now is different.  I have several places in the site where I need to send an email.  I want to send the email addresses (to and from), the subject and body as strings to a sub, and have the sub generate the email.  Can I dd this sub to the code behind of the Master Page?  Where?  Should it be in the App_Code folder?  How?  None of the options to select from seems appropriate, for instance this isn't a class.  Hos do I call the sub from each of the pages I need to send email from?

Is there a good overview of this anywhere? 

Diane

"TOMCIO" <>
NewsGroup User
Re: Need a good tutorial on ASP.NET 2.0 code behind1/17/2007 4:01:00 PM

0

1) info how to sen mail here :
http://www.systemnetmail.com/

2) Because you have few places in your app. where you need send mial , you right you shoul place code in App_code folder - that way you will be able to reuse same code for many pages. I could send you code but i think you should take a look at this (it is very, very good tutorial & and will help you understand how all this is working ) so i guess it will be better for you :

http://www.asp.net/learn/dataaccess/default.aspx?tabid=63 - it shows how to use data acces layer, business logic layer - you will love it. You should read all tutorials (BTW i belive the one you need now is BLL )

 Hope this will help you


Tom | NMGroup.net
1&1 Hosting | WebHost4life | CrystalTech
"Mainship" <>
NewsGroup User
Re: Need a good tutorial on ASP.NET 2.0 code behind1/17/2007 5:07:22 PM

0

Wow, that's a lot of information!  Thank you.  I want to implement DAL and BLL in this project, but don't know how.  I had bookmarked some links, but it looks like what you sent me will answer most, if not all of my questions.  I'm at a good point in the project to start really getting into the database coding, so I'm going to go make a pot of herbal tea, then settle in to do some reading.

You're right, learning how to do what I need is better than being given the code.  I would have used the code to try to understand it, then would have asked where I can find this kind of information. 

I'm sure I'll be back with more questions.  But at least I'll have a better understanding of what I'm trying to do.  Thanks again!

Diane

"Mainship" <>
NewsGroup User
Re: Need a good tutorial on ASP.NET 2.0 code behind1/17/2007 6:48:09 PM

0

The page you sent me to is great.  There's a lot of information on things I had questions about.  In a few minutes I'm going to creat my first Data Access Layers for some pages that need to display data, each using a repeater control.  I already have a couple of these pages working by accessing the database directly.  Believe it or not, I'm excited about being able to add a DAL!  I feel like I'm closer to playing with the big boys!

But I don't understand how this helps me send email.  The email page you sent me to is also a great resource.  I'm already able to send an email message, but only the most basic kind.  This page goes way beyond that!

But I'm sending the email from within the form.  What I want to do is create 4 strings from within the form: sendTo, sendFrom, sendSubject and sendBody, then send these four strings to a function or sub that will handle actually sending the email.  I'm able to create the four strings with no problem.   Where do I create the function or sub, and how do I call it?  Can I put it in the Master page code behind file?  Do I put it in an inlude file?  Creating a class has been suggested, isn't that overkill?

Diane

"Mainship" <>
NewsGroup User
Re: Need a good tutorial on ASP.NET 2.0 code behind1/17/2007 8:10:34 PM

0

Tom, never mind about the email.  I did try to create a class for it.  It was easy, I can add to it as needed, and I decided I like classes!

So now I'm working on adding a DAL.  I'm probably starting with the wrong page!  This page uses a repeater to display the names of everyone who joined or whose ad has been updated within the past 60 days.  The SqlDataSource is:

<

asp:SqlDataSource ID="SqlDataSource1" runat="server" SelectCommand="select [First Name], [Last Name], [City], [State], [ReNewAd], [Male or Female], [File2], [NewAd] from [prisonmembers] Where ([NewAd] IS NOT NULL) and (DateDiff(dd, NewAd, getdate()) <= 60) order by [NewAd] Desc" ConnectionString="<%$ ConnectionStrings:wapApp %>" ></asp:SqlDataSource>

This page is currently working, yet when creating thre DAL, the select string isn't being accepted.  I changed it to

"SELECT [ReNewAd], [Male or Female], [File2], [PHOTO], [First Name], [Last Name], [City], [State], [NewAd] FROM PrisonMembers Where ('NewAd' IS NOT NULL AND (DateDiff(dd, [NewAd], @Today') <= 60)) order by [NewAd] Desc"

But it really doesn't like the <= signs.  Can I use the DateDiff function in the select string?  How?

Diane

"TOMCIO" <>
NewsGroup User
Re: Need a good tutorial on ASP.NET 2.0 code behind1/17/2007 10:21:00 PM

0

why don't you use the working command ? the 2nd one is different and have you have "Where ('NewAd' IS NOT NULL " I belive it should be [NewAd]
+ after @Today ' <---- ???

Tom | NMGroup.net
1&1 Hosting | WebHost4life | CrystalTech
"Mainship" <>
NewsGroup User
Re: Need a good tutorial on ASP.NET 2.0 code behind1/17/2007 10:56:39 PM

0

Huh? 

I'm looking for records where NewAd is not null and the date in NewAd is within the past 60 days.  What do you mean by 'working command'?   Is @Today a standard parameter?  Is there a good article or tutorial on this somewhere?  How do I use it to find records less than 60 days old?

I tried to create a DAL for one of the simpler pages.  I'm about to test it.  If I can get it working, today will have been a GOOD day!

Diane 

29 Items, 2 Pages 1 2 |< << Go >> >|


Free Download:













response.write problems

where is my toolbox

access database class

reset controls

reference virtual directory

creating a data access layer and creating a business logic layer videos?

no rows in a dataset problem.

help on working with dal and bll classes

removing duplicate values from arraylist

how to retrieve output value from sql?

a basic questions about a string variable?

starting a process on server

broken images?

cs / vb files in seperate folder? question

&amp; instead of &

iis and asp .net

formview postbacks

replace broken image icon in gridview

iis not looking for classes in app_code by default...please help!

how can i tell vs.net 2005 to ignore some directories when i hit compilation?

what exactly means by executiontimeout

need help starting a c# asp.net project.

learning asp.net

conecting database to dataset created dynamically

sql need help with custom error

post headers..

server time || client time

default namespaces

regex to return content between two tags (ignoring inner tags)

button click event

user control a needs to access a user control b property - how?

connection pooling

cant create or open web applications

how to grab email id from mailbox

end of statement expected

comexception - system.runtimetype.forwardcalltoinvokemember???

problem when returning from a popup calendar

object creation

v1 and v1.1 - how to choose v1.1?

remoting

session variables

1.1 vs 2.0?

asp help

smartnavigation

problem with verbatim string

using web user controls as variables/objects in classes.

variables in one line

need help

masterpage with a menu control

database connectivity in c# and asp.net

   
  Privacy | Contact Us
All Times Are GMT