Wednesday, March 11, 2009

Fun With GridView...

[EDIT: This is being posted now, but was started back in 2006, so might be a little out of date. My aim is to have no draft posts and this was too useful to delete.]

So I've been playing with databinding controls etc and trying to do things the easy way, I've discovered CodeSmith: http://www.codesmithtools.com/. Used in conjunction with NetTiers2: http://www.nettiers.com/ is a very powerful data access layer code generator.

Anwyay, todays subject, minor though it is, is GridView commands...
...I wanted to have a grid with a couple of buttons: Up and Down, as link buttons, to re-order my content without an edit button.

The solution is simple enough:
  1. Add a Button column to your GridView
  2. Set it's 'button type' to Link (this is optional really)
  3. In the GridView's events panel, double-click RowCommand
  4. In the generated event handler you can place:
    switch (e.CommandName) { .... }

Simple really.

Lastly, here's some resources I've been looking at recently:

  1. http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowcommand.aspx
  2. http://weblogs.asp.net/scottgu/archive/2005/10/18/427754.aspx
  3. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/ASPNETProvMod_Prt5.asp
  4. http://www.ondotnet.com/pub/a/dotnet/2005/01/10/liberty.html
  5. http://www.odetocode.com/Articles/440.aspx
  6. http://www.asp.net/QuickStart/aspnet/doc/profile/default.aspx
  7. http://www.theserverside.net/tt/articles/showarticle.tss?id=CreatingProfileProvider
  8. http://flimflan.com/blog/ProfileView.aspx
  9. http://weblogs.asp.net/scottgu/archive/2006/01/10/435038.aspx
  10. http://www.asp.net/sandbox/samp_profiles.aspx?tabindex=0&tabid=1
  11. http://msdn2.microsoft.com/en-us/library/83y98ckk.aspx
  12. http://www.google.com/search?hl=en&lr=&q=aspnet_regsql+command-line+utility+&btnG=Search
  13. http://www.learnvisualstudio.net/
  14. http://www.asp.net/learn/absolute/default.aspx?tabid=63
  15. http://www.microsoft.com/uk/msdn/security/link_library.mspx
  16. http://weblogs.asp.net/scottgu/archive/2006/04/13/Source-Code-for-the-Built_2D00_in-ASP.NET-2.0-Providers-Now-Available-for-Download.aspx
  17. http://weblogs.asp.net/scottgu/archive/2006/02/24/438953.aspx

No comments:

Post a Comment