Results 1 to 1 of 1
Thread: Implementing custom detailviews
Jan 3, 2008, 10:13 #1
- Join Date
- Jan 2008
- 0 Post(s)
- 0 Thread(s)
Implementing custom detailviews
Hello, my name is Martin Persson and I am rather new to ASP.Net programming. I am currently implementing a simple system for manipulating database entries, much like functionality that DetailsView provides. However I have some special requirements that I am unsure on how to approach implementaion-wise.
The basic functionality is a list of orders matching a certain criteria. Once on is selected it should be loaded into a FormView for editing.
Currently I have this implemented on a single page using multiple controls. But I have run into some trouble with this approach. Once an item is selected I create a SQL query string in the form of "SELECT ... FROM [orders] WHERE [id] = ", assign it to the SqlDataSource and call DataBind() on the FormView. The problem is that when an order isn't selected, there are no results for the FormView to display.
So at this point I am wondering if I should reimplement this as a custom control (seems wrong since suspect I'd have to hardcode some of the data selection logic into it) or... hide the FormView?
I read a post about setting a parameter to null at the SqlDataSource, thereby preventing a databind() with a property set to true. However, I've seen no practical example of this, could anyone show me exactly WHAT is supposed to be null for it to take effect?
Or perhaps I am overdoing this? The the most simple solution might just be to perform a query and assign the result in code altogether?
Thanks for any help,
Update: As usual I remembered how I was supposed to solve this immediately after posting this: Simply using parameterized queries with the SqlDataSources and a control as source solved this in a jiffy.
Last edited by xarragon; Jan 4, 2008 at 06:41. Reason: Me being a dumbass