Last post Oct 21, 2007 08:42 PM by crf250guy
Oct 20, 2007 06:00 PM|crf250guy|LINK
I have a page that exists of only a sqldatasource and a formview linked to the sqldatasource. Is there any way to set a variable from a querystring that dictates a column value to use in the WHERE statement of the datasource? Example: default.aspx?columnname=2&columnvalue=5
=> Only data with value 5 in the column 2 would be displayed to be viewed, edited, inserted, etc.
Oct 21, 2007 07:05 AM|MaineOne|LINK
I assume you want that Columnvalue to change, if so where will the value be coming from. A little more info and I can help.
Oct 21, 2007 08:42 PM|crf250guy|LINK
Sorry to be so vauge. The problem has actually evolved since my first post. I am adding a forum to my PWS and I have learned a bit more now so I am now using objectdatasources instead of sqldatasources. I have the entire thing coded, but I need to make one
The forum consists of a dynamic "list of forums" page with various threads on it and a dynamic view page which prints a list of posts. It uses three sql database tables: forums -> threads -> posts. The threads and posts tables include a ParentID value which
is equal to the key value of their parent (recursively).
The Forums page repeats a forum title followed by that forums list of threads. Each listed thread is created as a link to to the view page concatinated with a querystring: "View.aspx?ThreadID = int"
The view page takes in the querystring when it loads, and stores it in a variable called ThreadID. The page has an objectdatasource to the posts table that uses a function to get a list of posts. The function takes in an integer and returns a list of posts
whose parentID is equal to that int.
Here is my problem: I need the object datasource to call that function using the variable ThreadID. I am basically looking for a generic way of using variables in the code page with object datasources in the form page. (I have separate code pages for each form.) I
also need to do something similar to the above listed problem for an insert function instead of a select function. I am assuming that the code involved will be very similar. I am a Junior, Comp Sci student and am very proficient with c++ and c#, but I have
about 15 hours total combined experience with ASP.net and SQL databases :)