Getting Data out of your DataControls

Rate It (4)

Last post 09-24-2009 4:33 AM by sandy060583. 54 replies.

Sort Posts:

  • Getting Data out of your DataControls

    12-18-2008, 8:57 PM
    • Contributor
      2,189 point Contributor
    • davidfowl
    • Member since 08-17-2008, 5:50 PM
    • Redmond
    • Posts 449
    • Moderator

    Please read this blog post before you start using FindControl or go digging into the control tree.

    http://weblogs.asp.net/davidfowler/archive/2008/12/12/getting-your-data-out-of-the-data-controls.aspx

    David Fowler
    SDE, ASP.NET Team, Microsoft
  • Re: Getting Data out of your DataControls

    12-19-2008, 4:27 AM
    • Contributor
      7,266 point Contributor
    • sirdneo
    • Member since 12-16-2008, 5:45 AM
    • Karachi, Pakistan
    • Posts 1,141

     

    Seems Interensting
    Thanks,
    Zeeshan Umar

    ~Please Mark As Answer, if one or multiple posts, which helped you in your problem. So that it might be useful for others~

    My Blog
  • Re: Getting Data out of your DataControls

    12-21-2008, 5:28 AM
    • Contributor
      3,470 point Contributor
    • rami_nassar
    • Member since 10-07-2008, 7:01 AM
    • U.A.E.
    • Posts 787

    Helpful..

    Regards...
    Nassar, Rami (MCP, MCTS)
    My Blog || E-Mail

    Don't forget to click "Mark as Answer" on the post that helped you.

    This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
  • Re: Getting Data out of your DataControls

    12-24-2008, 4:25 AM
    • Member
      2 point Member
    • Prachik
    • Member since 12-23-2008, 9:11 AM
    • Posts 2

     Nice !!!

  • Re: Getting Data out of your DataControls

    12-25-2008, 5:04 AM
    • Member
      2 point Member
    • Deepalisk
    • Member since 12-24-2008, 1:24 PM
    • Posts 2

    Nice.

  • Re: Getting Data out of your DataControls

    12-26-2008, 6:13 AM
    • Participant
      928 point Participant
    • MisterFantastic
    • Member since 09-21-2008, 5:56 AM
    • Chennai
    • Posts 276

     Hi,

    Is this very helpful in  handling user controls ?

    Please let me know the advantages of this.

    Thanks,

    Thani

    Tao of Jeet Kune Do
  • Re: Getting Data out of your DataControls

    12-27-2008, 5:27 PM
    • Contributor
      3,470 point Contributor
    • rami_nassar
    • Member since 10-07-2008, 7:01 AM
    • U.A.E.
    • Posts 787

    it's the only way to get data from controls inside data controls

    Regards...
    Nassar, Rami (MCP, MCTS)
    My Blog || E-Mail

    Don't forget to click "Mark as Answer" on the post that helped you.

    This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
  • Re: Getting Data out of your DataControls

    12-27-2008, 9:09 PM
    • Contributor
      2,189 point Contributor
    • davidfowl
    • Member since 08-17-2008, 5:50 PM
    • Redmond
    • Posts 449
    • Moderator

    what is?

    David Fowler
    SDE, ASP.NET Team, Microsoft
  • Re: Getting Data out of your DataControls

    12-28-2008, 7:23 AM
    • Contributor
      4,609 point Contributor
    • Nemesis116
    • Member since 09-25-2008, 6:09 AM
    • Geel
    • Posts 918
    Nice article. But why does Microsoft gives us such a powerful/clean function called FindControl, while your method isn't embedded in the framework?
    Jef Claes
    ~~~~~~~~~~


    Visit my blog
    Let's Twit!
  • Re: Getting Data out of your DataControls

    12-28-2008, 11:34 AM
    • Contributor
      2,189 point Contributor
    • davidfowl
    • Member since 08-17-2008, 5:50 PM
    • Redmond
    • Posts 449
    • Moderator

    If you read the article, you'll see that the method is embedded in the framework and on the ListView the method is public.I don't know exactly why we made the decisions we did my not exposing that method on the other controls, but FindControl is an abused function and people don't know how to use it properly. Wouldn't you rather have an api to get the values (because that is what you really want), rather than the thing that contains the values? Supposed your using bound fields and turned HtmlEncode and other formatting options on for your cell, do you want to use FindControl and have to figure out what sequence of methods to call to get the unformatted data back? Why not call ExtractValuesFromCell which knows how to do that?

    I'm not saying don't use FindControl its just not the silver bullet that fixes all problems.

    Hope this helps

    David Fowler
    SDE, ASP.NET Team, Microsoft
  • Re: Getting Data out of your DataControls

    12-28-2008, 6:53 PM
    • Contributor
      4,609 point Contributor
    • Nemesis116
    • Member since 09-25-2008, 6:09 AM
    • Geel
    • Posts 918

    You are correct Smile I think it's funny because it's the first time ever I see someone using this method. While everyone is using FindControl as a standard.

    I'm going to keep this in mind next time I need to get the value out of datacontrol. Thank you.

    Jef Claes
    ~~~~~~~~~~


    Visit my blog
    Let's Twit!
  • Re: Getting Data out of your DataControls

    12-31-2008, 6:18 AM
    • Contributor
      3,470 point Contributor
    • rami_nassar
    • Member since 10-07-2008, 7:01 AM
    • U.A.E.
    • Posts 787

    its like this

     

    CType(yourDataControl.FindControl("yourControlID"), yourControlType).putTheProperityHere
     
    Regards...
    Nassar, Rami (MCP, MCTS)
    My Blog || E-Mail

    Don't forget to click "Mark as Answer" on the post that helped you.

    This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
  • Re: Getting Data out of your DataControls

    12-31-2008, 11:30 AM
    • Contributor
      2,189 point Contributor
    • davidfowl
    • Member since 08-17-2008, 5:50 PM
    • Redmond
    • Posts 449
    • Moderator

    Why use FindControl if you don't have to?

    David Fowler
    SDE, ASP.NET Team, Microsoft
  • Re: Getting Data out of your DataControls

    12-31-2008, 2:20 PM
    • Contributor
      3,470 point Contributor
    • rami_nassar
    • Member since 10-07-2008, 7:01 AM
    • U.A.E.
    • Posts 787

    david, why you say that.. can you explain your idea??

    Regards...
    Nassar, Rami (MCP, MCTS)
    My Blog || E-Mail

    Don't forget to click "Mark as Answer" on the post that helped you.

    This credits that member, earns you a point and marks your thread as Resolved so we will all know you have been helped.
  • Re: Getting Data out of your DataControls

    12-31-2008, 2:28 PM
    • Contributor
      2,189 point Contributor
    • davidfowl
    • Member since 08-17-2008, 5:50 PM
    • Redmond
    • Posts 449
    • Moderator

    Did you read the blog post?

    David Fowler
    SDE, ASP.NET Team, Microsoft
Page 1 of 4 (55 items) 1 2 3 4 Next >