How to bind data to GridView table

Posted on 2008-11-04
Last Modified: 2013-12-17

In the table seen in the picture below I'm trying to populate column 1 with information based on the users login name.  The first section will provide two boxes for the user name and domain.  Based on this information the cells in column 1 will automatically populate.

Need help with this.

Question by:John500
    LVL 10

    Accepted Solution

    Create your gridView, bind your gridView datasource to an ObjectDataSource which rely on username and domain, this ObjectDataSource has a select method which require 2 parameters loginname & domain.

    Look at my example, the UserProject.UserClass is a class where you define the GetUserChangeTable(string loginname, string domain)

    Hope this helps


    <asp:GridView ID="gvUserChange" runat="server"  DataSourceID="objdsUserChange" ...>
    <asp:ObjectDataSource ID="objdsUserChange" runat="server" SelectMethod="GetUserChangeTable" TypeName="UserProject.UsersClass" ...>
                        <asp:ControlParameter ControlID="tbLoginName" PropertyName="Text" Type="String" />		
                        <asp:ControlParameter ControlID="ddlDomain" PropertyName="SelectedValue" Name="Domain" Type="String" />

    Open in new window


    Author Closing Comment

    Thank you

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    New Relic: Our company recently started researching several products to figure out what were the best ways for us to increase our web page speed and to quickly identify performance problems that we may be having. One of the products we evaluated wa…
    Introduction A frequently used term in Object-Oriented design is "SOLID" which is a mnemonic acronym that covers five principles of OO design.  These principles do not stand alone; there is interplay among them.  And they are not laws, merely princ… provides powerful tools for surveying targeted groups, and utilizing data from completed surveys to find trends, discover areas of demand or customer expectation, and make business decisions on products or services.
    Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…

    794 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now