newbie question on data in code

  • Thread starter Thread starter Neil
  • Start date Start date
N

Neil

Hi,

I need to access some data in my normal code.

I assume that i need to create a datasource as per this example:

<asp:sqldatasource id="SqlDataSource3" runat="server" connectionstring="<%$
ConnectionStrings:interarcConnectionString %>"
selectcommand="SELECT [ID], [CategoryID] FROM [vtg_tblRangeList]
WHERE ([ID] = @ID)"><SelectParameters>
<asp:QueryStringParameter Type="Int32" Name="ID"
QueryStringField="RID"></asp:QueryStringParameter>

but how do I then access the data as in

<%
iCID = CategoryID
%>

Many thanks for any advice.

NEIL
 
Hi,

I need to access some data in my normal code.

I assume that i need to create a datasource as per this example:

<asp:sqldatasource id="SqlDataSource3" runat="server" connectionstring="<%$
ConnectionStrings:interarcConnectionString %>"
selectcommand="SELECT [ID], [CategoryID] FROM [vtg_tblRangeList]
WHERE ([ID] = @ID)"><SelectParameters>
<asp:QueryStringParameter Type="Int32" Name="ID"
QueryStringField="RID"></asp:QueryStringParameter>

but how do I then access the data as in

<%
iCID = CategoryID
%>

Many thanks for any advice.

NEIL

For data binding you should use the <%# %> notation

<%# Eval("CategoryID") %>
 
For data binding you should use the <%# %> notation

<%# Eval("CategoryID") %>


Hi Alexey,

If this were in a control, yes, but I want to store the CategoryID as iCID
for leter use - so how do I do this?

I am totally new to ASP.NET, quite used to ASP 3.0, so it all appears odd to
me!

Basically, CategoryID is a foregn key which needs to be noted so that when I
loop through the relevent linked table later I can identify the chosen
selection and format my list differently for that data item.

Hope this makes sense?

NEIL
 
Back
Top