Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > ASP.NET 4 General Discussion
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 4 General Discussion For ASP.NET 4 discussions not relating to a specific Wrox book
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 4 General Discussion 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
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 8th, 2011, 10:23 AM
Authorized User
Points: 221, Level: 4
Points: 221, Level: 4 Points: 221, Level: 4 Points: 221, Level: 4
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2010
Posts: 55
Thanks: 9
Thanked 0 Times in 0 Posts
Default how do i use the same integer in vb at aspx page?

if i have integer in my vb code like that

PHP Code:
  Protected Sub Page_Load(ByVal sender As ObjectByVal e As System.EventArgsHandles Me.Load
Dim i 
As Integer 
and i trying to take this intger to my aspx page
PHP Code:
<%@ Page Language="VBMasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="Default.aspx.vbInherits="_Default"  Debug="true" title="sample" %>

<
asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<%  
Response.Write(i)%>
    <
style type="text/css">
        .
style1
        
{
            
width100%;
        }
    </
style>
</
asp:Content
its not work,why?
thanks for help
Reply With Quote
  #2 (permalink)  
Old April 8th, 2011, 12:21 PM
Friend of Wrox
Points: 2,473, Level: 20
Points: 2,473, Level: 20 Points: 2,473, Level: 20 Points: 2,473, Level: 20
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2004
Location: India
Posts: 642
Thanks: 0
Thanked 43 Times in 42 Posts
Default

This can be done by the following syntax.
<%= i %>

The codebehind variable should be public variable so that it can be accessed in the ASPX page:

Code:
public partial class _Default : System.Web.UI.Page 
{
    public int i = 0;
.
.
__________________
Om Prakash Pant
Click the "Thanks" button if this post helped you.
Reply With Quote
The Following User Says Thank You to om_prakash For This Useful Post:
nir987 (April 8th, 2011)
  #3 (permalink)  
Old April 10th, 2011, 11:02 AM
Authorized User
 
Join Date: May 2006
Location: , , .
Posts: 26
Thanks: 0
Thanked 0 Times in 0 Posts
Default

make your variable public or protected in order to access it from aspx
and use <%= Variable_Name %>
__________________
Regards,
Rashida Rauf
http://www.questions-interviews.com
Reply With Quote
Reply


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Code for Chpt.2-Wrox File Share is missing Default.aspx and Default.aspx.vb bzoni BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 1 October 23rd, 2009 02:39 PM
converting the string to integer vb .net 2005 Subjugate .NET Framework 2.0 1 November 25th, 2006 02:18 PM
Page 228 TIO 5 Fixtures.aspx [VB] bcr212 BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 0 May 24th, 2006 06:55 AM



All times are GMT -4. The time now is 12:44 AM.


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