Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Beginner gridview question

Reply
Thread Tools

Beginner gridview question

 
 
Paul
Guest
Posts: n/a
 
      07-02-2008
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.
 
Reply With Quote
 
 
 
 
jm
Guest
Posts: n/a
 
      07-02-2008
On Jul 2, 4:06*pm, Paul <P...@discussions.microsoft.com> wrote:
> 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.
 
Reply With Quote
 
 
 
 
Paul
Guest
Posts: n/a
 
      07-02-2008
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.com> wrote:
> > 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.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Beginner's Beginner william nelson Ruby 7 04-11-2011 11:23 PM
Question: Gridview within Gridview issue Cirene ASP .Net 1 11-04-2007 05:38 PM
GridView Hierarchical View - Gridview in Gridview =?Utf-8?B?bWdvbnphbGVzMw==?= ASP .Net 1 05-09-2006 06:48 PM
No Class at ALL!!! beginner/beginner question =?Utf-8?B?S3VydCBTY2hyb2VkZXI=?= ASP .Net 7 02-03-2005 02:47 PM
Tutorial for beginner/ Tutorial voor beginner Rensjuh C++ 7 09-02-2004 12:41 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57