By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,017 Members | 1,238 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,017 IT Pros & Developers. It's quick & easy.

Beginner gridview question

P: n/a
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.
Jul 2 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
jm
On Jul 2, 4:06*pm, Paul <P...@discussions.microsoft.comwrote:
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.
Jul 2 '08 #2

P: n/a
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_SelectedIndexChanged(object sender, EventArgs e)
{
foreach (GridViewRow myRow in this.gvwDiscrepancies.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.SelectedValue.ToString();
}
}
}
--
Paul G
Software engineer.
"jm" wrote:
On Jul 2, 4:06 pm, Paul <P...@discussions.microsoft.comwrote:
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.
Jul 2 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.