Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 5th, 2005, 11:34 AM
Registered User
 
Join Date: Mar 2005
Location: Pune, Maharashtra, India.
Posts: 9
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to Anup Gavate Send a message via Yahoo to Anup Gavate
Default can any one help me

I am a new .NET developer and before worked on ASP.

I need to know if i can use code given below successfully in ASP :)
Actually i am using this code for paging and i need to apply same code in ASP.net for paging.

        'Display Paging
        Response.Write("<tr><td colspan='2'>")
        Response.Write("<form name='paging' method='post' action='gift_experiences.aspx'>")
        Response.Write("<table width='100%' border='0' cellspacing='0' cellpadding='0' align='center'><tr>")
        Response.Write("<td height='20' valign='middle'>")
        If intPageNumber = 1 Then
            Response.Write("<< Previous")
        Else
            Response.Write("<a href='gift_experiences.aspx?CatId=" & intCatId & "&Page=" & (intPageNumber - 1) & "'><< Previous</a>")
        End If
        Response.Write("<img src='/images/spacer.gif' width='10' height='1'>")
        If intPageNumber = intTotalPages Then
            Response.Write("Next >>")
        Else
            Response.Write("<a href='gift_experiences.aspx?CatId=" & intCatId & "&Page=" & (intPageNumber + 1) & "'>Next >></a>")
        End If
        Response.Write("</td><td height='20' valign='middle' align='right'>")
        Response.Write("<input type='text' name='Page' value=" & intPageNumber & " style='width:25px' maxlength='3' class='TextField'>")
        Response.Write("<img src='/images/spacer.gif' width='10' height='1'>")
        Response.Write("<input type='Hidden' name='CatId' value=" & intCatId & ">")
        Response.Write("<input type='Submit' name='Paging' value='Go' style='width:25px;height:20px' class='button'>")
        Response.Write("</td></tr></table>")
        Response.Write("</form>")
        Response.Write("</td></tr>")

then how can i modify it so that it will work in ASP.NET.

When i am trying different ways so that i can use variable values like <%=intCatId%> in the body of the page, i came accross an error
'Name 'intCatId' is not declared'. How do define variables so that i can use them throughout a page.

Thx in Adv
  #2 (permalink)  
Old April 5th, 2005, 12:53 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

I would get out of that approach, using Response.write in the page; Response.Write puts that code whereever it wants, and will not execute where you have it.

http://msdn.microsoft.com/library/de...jectmodel2.asp

This example isn't the greatest, but it's what I could find that had table creation in code-behind, and you can set the attributes you want there. Hope this helps.

Brian
  #3 (permalink)  
Old April 6th, 2005, 05:53 AM
Registered User
 
Join Date: Mar 2005
Location: Pune, Maharashtra, India.
Posts: 9
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via MSN to Anup Gavate Send a message via Yahoo to Anup Gavate
Default

Hi bmains

Look, using Response.write method, we can put whatever we want to wherever in the page depending on the constraints we provided for
the display.

I referred your link, its another way but here code just grows and grows. Can u tell me how define global variables, so that i can define them at top, assign value to them in any subroutine and can use in the body ie in any text field or in anchor tag.


  #4 (permalink)  
Old April 7th, 2005, 06:44 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Harrisburg, PA, USA.
Posts: 1,998
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Using server controls in the code-behind page allows the .NET framework create the markup based on the browser control. In the code-behind, to add an element directly as is, you can use the LiteralControl class, pass in the text.

Within the code, define a variable as private:

private m_objValue as Value

You should be able to use it; though you have to maintain the value across postbacks with the viewstate, session, or cache.


Brian
  #5 (permalink)  
Old April 7th, 2005, 10:43 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: , , .
Posts: 540
Thanks: 0
Thanked 4 Times in 4 Posts
Default

Quote:
quote:Originally posted by Anup Gavate
 Hi bmains

Look, using Response.write method, we can put whatever we want to wherever in the page depending on the constraints we provided for
the display.
I agree with Brian on this. Response.Write is the classic ASP way of doing things. There are ways of implementing what you want without constantly using Response.Write.

For example, in addition to literal controls you can use the panel control, embed a table within it and based upon the course of action by the user either hide it or show it.

J
  #6 (permalink)  
Old April 10th, 2005, 04:11 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Anup,

I'd recommend that you play around with .NET and learn generally how it works. Then you should be able to figure out for yourself how to transfer ASP applications to .NET applications. You will undoubtedly find that there are many many better ways of doing things in .NET then there were/are in ASP.

-Peter
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off




All times are GMT -4. The time now is 02:52 AM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.