SQL Server Data base connection in ASP.NET

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • TCooper
    New Member
    • Feb 2007
    • 1

    #1

    SQL Server Data base connection in ASP.NET

    I am using Visual Web Developer and the form contains two SQLDataSources that are linked to two GridViews.I am trying to link a parameter in the first SQLDataSource component with a field returned by the other SQLDataSource component. Both contains a stored procedure that returns a set of data that has a master/child relationship. I cannot find any obvious way of doing this which is a very simple task on other platforms.
    To link a parameter to an input control is trivial but I want the data in the second Griview to show a different set of data depending on the user selection in the first Gridview.

    Would be very grateful for any pointers in the right direction.

    TCooper.
  • kenobewan
    Recognized Expert Specialist
    • Dec 2006
    • 4871

    #2
    So you want to use the first datasource in the page load event and populate the first gridview. Then you want to use the event triggered by the user selection to insert as a parameter with your second datasource to create a child gridview. Is this what you are trying to achieve?

    Comment

    • rashmitha reddy
      New Member
      • Feb 2007
      • 6

      #3
      HI,

      I suppose you wanted to get the data in second grid based on the first datasource.If it is so you can do one thing take a field by which you wanted to get the data in second grid .Go to the template column on your first grid and declare a lable Id of that particular column and add object reference in your code.
      For Ex- Label lblId=new Label( );
      lblId=(Label)e. items.cells[ No . of that field].findcontrol(lb lId);
      then bind your second grid for that Id.using your Sp get the required info in your datagrid Itemcommand only.

      Comment

      Working...