Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 4 > ASP.NET 4 General Discussion
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 8th, 2011, 10:23 AM
Authorized User
 
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
 
Old April 8th, 2011, 12:21 PM
Friend of Wrox
 
Join Date: May 2004
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.
The Following User Says Thank You to om_prakash For This Useful Post:
nir987 (April 8th, 2011)
 
Old April 10th, 2011, 11:02 AM
Authorized User
 
Join Date: May 2006
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





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





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