Click here to Skip to main content
15,891,372 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I wish to pass some values retrieved from SQL DB to a page, the page is designed without ASP tools, and I wish to pass some values to be displayed on the page, but can't do it yet : \

this is an example:


What I have tried:

C#
public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string x = "hello from .cs";
    }
}


and

HTML
<p class="some class">Here comes the x value from .cs
Posted
Updated 29-Dec-20 21:40pm

1 solution

Make "x" a property;

C#
public string X {get; set;}


Then set it like

protected void Page_Load(object sender, EventArgs e)
{
    X = "hello from .cs";
}


Your aspx will then be

<p class="some class"><%=X%></p>
 
Share this answer
 
Comments
Hamza M. S. Abazeed 1-Jan-21 11:44am    
Thanks, that works :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900