• pwalter83 (1/28/2013)


    Sean Lange (1/28/2013)


    OK easy enough. As I said previously you will need to use an event of the button. Since you want this to happen when the user clicks the button, you will use the click event.

    Just add code to your click event to run your query. Stick the results of your query into a datatable and bind your gridview to the datatable.

    Thanks Sean,

    Do I need to add the code to the 'OnClientClick' property ? This is the only property I can see on the list.

    Also, I cannot find the component 'datatable', is it the same as 'Table' ?

    lastly, do you refer to gridview as the component or as a property ?

    Sorry for the botheration.

    Thanks.

    I am going to guess you don't know much about web development. The OnClientClick event is the client side event for clicking. You want the server side event (unless you are going to do this via jquery).

    DataTable belongs to the System.Data namespace. I don't know how you are querying your data. If you are using a SqlDataSource you will have to add parameters to the select property and requery server side.

    The GridView is what you will use to display the results of your query.

    I would highly recommend you dig around and find some tutorials on basic asp.net development. Not trying to sound rude but you really need to understand what you are doing and from your posts it seems you are very unfamiliar with how this stuff works. Web development is quite different than windows applications because you have code that runs on the server and code that runs on the client and you have to deal with both.

    _______________________________________________________________

    Need help? Help us help you.

    Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.

    Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.

    Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
    Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
    Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
    Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/