ASP.net question

Baz

Baz

Soldato
Joined
9 Dec 2002
Posts
4,376
Location
Peterborough
Trying to build a page, and already done most of the intranet site in asp.net 2.0 with VS2005. BUt I am stuck on one item.... tricky to explain,


The user, via a text box, needs to input an ID number for a recordset to display the data, but as a form later in the page needs another item from the row, that is not known at the beginning, I am trying to store that item somewhere and recall it. In ASP classic, you could use the session object, not sure how to do it in ASP.NET 2, tried using hidden gridviews and fields to no avail....



if you need a better explanation, i will try :S
 
Cool, thanks :)

so i could use something like this, in the <asp:SqlDataSource> tag?

Session("test") = [field_name] ??

edit: ok, not in that tag :p
 
You can't do anything programmatic within runat="server" tags - apart from binding data to controls. You have to reference them from code.

eg:

in the .aspx:
<asp:SqlDataSource id="SQLDataSource1" runat="server">

in .aspx.cs:
SqlDataSource1.ConnectionString = Session["connection_string"];

Is that along the lines of what you wanted to achieve?
 
Mr^B said:
You can't do anything programmatic within runat="server" tags - apart from binding data to controls. You have to reference them from code.

eg:

in the .aspx:
<asp:SqlDataSource id="SQLDataSource1" runat="server">

in .aspx.cs:
SqlDataSource1.ConnectionString = Session["connection_string"];

Is that along the lines of what you wanted to achieve?

Already have the sql.datasource tags as i have several datasources in the page linked to several datalists and grids....

What I have is a dropdownlist linked to one datasource that brings back the PO numbers, that is fed into several other sql datasources which then output the data to the datalists and gridviews. One piece of information, a pallet ID field, i need to add to a SQL datasource in order to retreive some data, without this field, i would have way too much data coming back form the PO number alone.... it is a one to many relationship, with one PO linked to < 12 pallet ID's. The only information the user will have, is the PO number.

Hope it makes sense..... ( you don't want to see the report I have to do though :eek: ) :)
 
Back
Top Bottom