examples of dynamic user control
I am working on a user control that will display the # of "services" that we are running and will show the name, extension, and start/stop buttons. This data is bounded to a database and then drawn at run time onto the aspx page.
I was reviewing the "newsusercontrol" sample from chapter 10. But am unable to modify this to work for me and have a few specific questions..
- I have my sqldatasource1 in the .ascx file yet when i start my application it will not pass the "exename" through to the control and I get a "Invalid value for parameter name." error. I dont understand how it is not getting the connection.
- For displaying a control that consists of 4 labels (2 of which output) and two buttons should I use a datalist or a repeater?
- If the datalist how can I absolutely position the template
field? The last one I created was just centered on the page
and blocked a lot out.
- is there a way to display exactly how many records are in the database without specifying a "itemstoshow" constant/property? Would a For (i<rows.EOF) or For(i<rows.count) work the same for me??
Basically at this point the only thing that works for my control is to hardcode the "exename" into the label and then draw it at design time. At that point it will stop or start using the Serviceprocess class. However, even with doing this I cannot get my repeater to work because the db values are not connecting.
Does anyone have another similar example or feel up to trying to debug my solution? Sorry if not much of this makes any sense, I have just started using ASP again for the first time since early 2003 when I did it in school.
|