1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Development C# .Net Datable Help

Discussion in 'Software' started by PBear23, 22 Mar 2011.

  1. PBear23

    PBear23 What's a Dremel?

    Joined:
    4 Feb 2009
    Posts:
    438
    Likes Received:
    7
    Hey guys/girls,

    I have started a windows application to display data from sql server database.

    I have two tables, the first is a table containing vehicle manufacturers and the second is a list of models of vehicles with assigned atributes (model, engine size, power etc. the two are related.

    I want to be able to click on a cell in the 'make' table and it display all of the models(and assigned attributes) in the model table. Can anyone help?

    Kind regards
     
  2. Daedelus

    Daedelus What's a Dremel?

    Joined:
    7 May 2009
    Posts:
    253
    Likes Received:
    12
    You mean like a collapsible view so that when you click on a make it expands to show you all the models they make?

    If so, there is nothing in ASP.NET to let you do that. You'll need to use javascript to show/hide the rows in your table.

    In a nutshell:

    In the RowCreated event of your table you need to hide the rows containing details of the models e.g. e.Row.Attributes.Add("style", "display:none;");

    Add an onclick event to the rows containing details of the makes e.g. e.Row.Attributes.Add("onclick", "onGridViewRowClick(this);");

    In your javascript function (onGridViewRowClick()) show the models for each make when you click on it. You could use jQuery for that so you can use the toggle() function.
     
  3. BentAnat

    BentAnat Software Dev

    Joined:
    26 Jun 2008
    Posts:
    7,230
    Likes Received:
    219
    even without ASP (i.e. Windows C#), you'd have to make a callback there to the next bit of data (be it from the db or already in memory), using the click events on the table cells.
    Or, a third party control, if ther eis one.
     

Share This Page