Ask a Question related to ASP.NET General, Design and Development.
-
Mike Christie #1
Very basic ASP.NET question
I've got some Java experience but no JSP or ASP and am trying to get to grips
with ASP.NET. I'd appreciate some help on a simple question.
I have been able to get databinding to work, and can display a string obtained
from the database on the screen by binding it to a label. However, if I have
an object instantiated in the page's scope, it seems like there should be an
easier way to output a string that I obtain from that object. I gather that
in JSP there was some syntax like:
<%= myObject.aStringProperty %>
that would substitute the value of this as a literal in the middle of the
html. I tried this syntax in ASP.NET with no luck; is there something
analogous? The reference I'm using (Wrox's "Professional C#") while pretty
good in many ways is a bit light on detailed ASP examples, and I couldn't find
anything about this in the ASP tutorials I looked at.
Thanks for any help.
Mike
Mike Christie Guest
-
Basic FLV question
Can someone please help me. we wish to stream flv files using Flash Media Server 2. we have installed the program however we are at a loss as to how... -
basic 3d question
Hi, Just a qiuck question....I have created a 3d world and exported it to director. I want to add a basic cube shape I create in 3dstudio max to... -
Basic Question
Hello, I've noticed in some sample code that sometimes people use the @ before a string when concatenating them. Example: string filePath =... -
Basic question b/w ASP & ASP .NET
I would like to know what is the basic difference between ASP and ASP .NET VB AND VB .NET ADO and ADO .NET look forward to your responses -
basic css question
In several of my posts lately, I have made it known that I am nto a huge fan of using newer stuff as opposed to older methods of getting things... -
John Timney \(Microsoft MVP\) #2
Re: Very basic ASP.NET question
When you are dealing with data objects, you are not really dealing with a
string property, more an item of a datatype that may contain a string. Try
reading this, it explains a lot about databinding and covers the area you
are asking about with soem useful examples and code.
[url]http://www.aspalliance.com/aspxtreme/webforms/multi-recordsingle-valuedatabi[/url]
nding.aspx
--
Regards
John Timney (Microsoft ASP.NET MVP)
----------------------------------------------
<shameless_author_plug>
Professional .NET for Java Developers with C#
ISBN:1-861007-91-4
Professional Windows Forms
ISBN: 1861005547
Professional JSP 2nd Edition
ISBN: 1861004958
Professional JSP
ISBN: 1861003625
Beginning JSP Web Development
ISBN: 1861002092
</shameless_author_plug>
----------------------------------------------
"Mike Christie" <mikec@athensgroup.com> wrote in message
news:VQidneobwe-nhq2iRTvUpQ@giganews.com...grips> I've got some Java experience but no JSP or ASP and am trying to get toobtained> with ASP.NET. I'd appreciate some help on a simple question.
>
> I have been able to get databinding to work, and can display a stringhave> from the database on the screen by binding it to a label. However, if Ian> an object instantiated in the page's scope, it seems like there should bethat> easier way to output a string that I obtain from that object. I gatherpretty> in JSP there was some syntax like:
>
> <%= myObject.aStringProperty %>
>
> that would substitute the value of this as a literal in the middle of the
> html. I tried this syntax in ASP.NET with no luck; is there something
> analogous? The reference I'm using (Wrox's "Professional C#") whilefind> good in many ways is a bit light on detailed ASP examples, and I couldn't> anything about this in the ASP tutorials I looked at.
>
> Thanks for any help.
>
> Mike
>
John Timney \(Microsoft MVP\) Guest
-
MS News #3
Re: Very basic ASP.NET question
Mike
In your HTML put
<asp:Label ID="lblID" runat="server"><%# myStrvar %></asp:Label>
In your Codebehind put in C#
private void Page_Load(object sender, System.EventArgs e)
{
myStrvar = "Hello Universe";
Page.DataBind(); // you need this
// Put user code to initialize the page here
}
"Mike Christie" <mikec@athensgroup.com> wrote in message
news:VQidneobwe-nhq2iRTvUpQ@giganews.com...grips> I've got some Java experience but no JSP or ASP and am trying to get toobtained> with ASP.NET. I'd appreciate some help on a simple question.
>
> I have been able to get databinding to work, and can display a stringhave> from the database on the screen by binding it to a label. However, if Ian> an object instantiated in the page's scope, it seems like there should bethat> easier way to output a string that I obtain from that object. I gatherpretty> in JSP there was some syntax like:
>
> <%= myObject.aStringProperty %>
>
> that would substitute the value of this as a literal in the middle of the
> html. I tried this syntax in ASP.NET with no luck; is there something
> analogous? The reference I'm using (Wrox's "Professional C#") whilefind> good in many ways is a bit light on detailed ASP examples, and I couldn't> anything about this in the ASP tutorials I looked at.
>
> Thanks for any help.
>
> Mike
>
MS News Guest
-
MS News #4
Re: Very basic ASP.NET question
Sorry missed declaring 'myStrvar'
protected string myStrvar;
private void Page_Load(object sender, System.EventArgs e)
{
myStrvar = "Hello Universe";
Page.DataBind();
// Put user code to initialize the page here
}
"MS News" <sql_agentman@hotmail.com> wrote in message
news:%23Rj$lf5WDHA.1004@TK2MSFTNGP12.phx.gbl...be> Mike
>
> In your HTML put
>
> <asp:Label ID="lblID" runat="server"><%# myStrvar %></asp:Label>
>
> In your Codebehind put in C#
>
> private void Page_Load(object sender, System.EventArgs e)
>
> {
>
> myStrvar = "Hello Universe";
>
> Page.DataBind(); // you need this
>
> // Put user code to initialize the page here
>
> }
>
> "Mike Christie" <mikec@athensgroup.com> wrote in message
> news:VQidneobwe-nhq2iRTvUpQ@giganews.com...> grips> > I've got some Java experience but no JSP or ASP and am trying to get to> obtained> > with ASP.NET. I'd appreciate some help on a simple question.
> >
> > I have been able to get databinding to work, and can display a string> have> > from the database on the screen by binding it to a label. However, if I> > an object instantiated in the page's scope, it seems like there shouldthe> an> that> > easier way to output a string that I obtain from that object. I gather> > in JSP there was some syntax like:
> >
> > <%= myObject.aStringProperty %>
> >
> > that would substitute the value of this as a literal in the middle ofcouldn't> pretty> > html. I tried this syntax in ASP.NET with no luck; is there something
> > analogous? The reference I'm using (Wrox's "Professional C#") while> > good in many ways is a bit light on detailed ASP examples, and I> find>> > anything about this in the ASP tutorials I looked at.
> >
> > Thanks for any help.
> >
> > Mike
> >
>
MS News Guest



Reply With Quote

