Beginner gridview question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?UGF1bA==?=

    Beginner gridview question

    Just wondering if anyone knows if this is possible with a gridview but I have
    a template column with two dropdown list boxes in it and when the user makes
    a selection in the first box I want to run an event that then takes the
    selected value of the first dropdown and feeds it into a stored procedure
    that returns a dataset that I want to display in the second dropdown list.
    If there is no data returned I want to hide the second dropdown list, any
    examples, thanks. I was doing this quite easily with the controls outside of
    the datagrid.
    Thanks.
    --
    Paul G
    Software engineer.
  • jm

    #2
    Re: Beginner gridview question

    On Jul 2, 4:06 pm, Paul <P...@discussio ns.microsoft.co mwrote:
    Just wondering if anyone knows if this is possible with a gridview but I have
    a template column with two dropdown list boxes in it and when the user makes
    a selection in the first box I want to run an event that then takes the
    selected value of the first dropdown and feeds it into a stored procedure
    that returns a dataset that I want to display in the second dropdown list..  
    If there is no data returned I want to hide the second dropdown list, any
    examples, thanks.  I was doing this quite easily with the controls outside of
    the datagrid.
    Thanks.
    --
    Paul G
    Software engineer.
    If you make them template columns, you can reference them in code
    easier, which may be what you did outside of the datagrid you
    mentioned.

    Comment

    • =?Utf-8?B?UGF1bA==?=

      #3
      Re: Beginner gridview question

      Thanks for the response. I think something like below may work as I am able
      to access the selected values in the template column. There is also a label
      in the column as well. I will just need to rebind the secondary dropdown
      feeding the selected value into the datasource first.

      protected void drdn1_SelectedI ndexChanged(obj ect sender, EventArgs e)
      {
      foreach (GridViewRow myRow in this.gvwDiscrep ancies.Rows)
      {
      Label lbl1 = myRow.Cells[2].Controls[1] as Label;
      DropDownList drdn1 = myRow.Cells[2].Controls[7] as DropDownList;
      if (drdn1 != null)
      {
      string stemp = drdn1.SelectedV alue.ToString() ;
      }
      }
      }
      --
      Paul G
      Software engineer.


      "jm" wrote:
      On Jul 2, 4:06 pm, Paul <P...@discussio ns.microsoft.co mwrote:
      Just wondering if anyone knows if this is possible with a gridview but I have
      a template column with two dropdown list boxes in it and when the user makes
      a selection in the first box I want to run an event that then takes the
      selected value of the first dropdown and feeds it into a stored procedure
      that returns a dataset that I want to display in the second dropdown list..
      If there is no data returned I want to hide the second dropdown list, any
      examples, thanks. I was doing this quite easily with the controls outside of
      the datagrid.
      Thanks.
      --
      Paul G
      Software engineer.
      >
      If you make them template columns, you can reference them in code
      easier, which may be what you did outside of the datagrid you
      mentioned.
      >

      Comment

      Working...