Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use my buttons, not the ones on the DetailsView

Status
Not open for further replies.

RenoirVandalet

Programmer
Sep 5, 2011
6
I have a detailsview tied to a sqldatasource and all works great if I use the default button shown on the bottom of the detailsview to Insert after entering data, but I want to use my own Save button, not that one. I have tried a number of things, but none seem to work. I thought that just calling detailsview.Update() in my button click code would handle it, but it does not update the table. No errors, but no updating either. Any help appreciated. I'll post whatever code requested.
 
Crap, I meant to say "sqldatasource.Insert()" up there. Don't see a way to edit my post...
 
You will have to use template columns to show your custom buttons. Not sure how to tie them into the datasource controls since I never use them. The datasource controls look good on the surface and may work for simple scenarios. If I were you, I would write my own custom data access layer. This way you have complete control over the code, and you will be able to easily debug it and maintain it.
 
I think I wasn't clear enough. I want to use a button that is not on the detailsview. I'm creating what looks like a button bar and once the user has completed entry, then I want the new Save button to handle the Insert of the data into the table. Really, if I could, I would like to not show the Insert button on the details view, but programatically fire it's Click method, but that seems to be an internal function.
 
OK, I see, but again it boils down to using the datasource controls. Since I don't use them, I don't know how to tie it into that button, and not directly to the details view. This is where your own data access layer would help.
 
Unfortunately, though I've been a developer for many years, .NET and c# are very new to me. This is for a class project, so not essential that it is at a business-production level. I appreciate your advice though.

If anyone knows how to do this using the sqldatasource and detailsview, please let me know.
 
i would suggest choosing 1 of two approaches:
1. use the details view as it was meant to be used and work with the default settings.
2. scrap the details view and the datasource control and take control of the program so it can do exactly what you want.

if you feel like you keep having to fight the framework to make it work then I suggest changing your approach. whether it means accepting the framework, changing the framework, or changing languages altogether. there are always multiple solutions to a given problem.

This is for a class project, so not essential that it is at a business-production level
yes there is a difference between spiking examples as a proof of concept and production ready code. but just because your "in a class room" don't sacrifice quality because it "isn't real". turning in this project for a grade should be treated as releasing the application to end users. I encourage you to think of your app as a production system. not a grade.

one last note: being this is a class project. be aware that this site has a zero tolerance policy on "doing homework". we are more than willing to help you with specific problems, but if it seems you are asking us to do your work for you, you will get reported to the moderators.

Jason Meckley
Programmer

faq855-7190
faq732-7259
 
Doing homework.

I am well beyond just doing homework on this. This is a Capstone graduate project of a working website. The only reason I say that it does not need to be production-level is that there is not a client that is depending on it, so it does not need to be perfect. I have never asked anyone to do the work for me and I don't believe I gave that impression. I only ask for guidance and help for me understand the functionality and syntax of an issue.

If the anyone believes that I'm asking for someone to do my homework rather than help understanding how to do it myself, then power to them and report away.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top