Ask a Question related to ASP.NET Data Grid Control, Design and Development.
-
AlBruAn #1
Retrieving SelectedValue from DropDownList
I have a few DropDownList controls used for new record entry in the footer of
a datagrid and I want to limit the options available in one list based on
what is selected in a previous list; I've seen examples of this where the
DropDownLists are used in edit mode, but none for data entry mode. The
footer cell for one column is defined as:
<FooterTemplate>
<asp:DropDownList ID="cboWorkflowID" AutoPostBack="true"
OnSelectedIndexChanged="OnSelectedIndexChanged" DataSource='<%#
GetWorkflowIDs() %>' Runat="server" DataMember="WorkflowID"
DataTextField="WorkflowID" />
</FooterTemplate>
Setting a breakpoint in the function OnSelectedIndexChanged, I am able to
pull up the Command Window and see the SelectedValue by typing in:
? ( ListControl ) sender. Despite that, I can't for the life of me figure
out how to programmatically retrieve the value. I've tried virtually every
permutation of ((DropDownList)(_grid.Items[0].FindControl("cboWorkflowID")))
I can think of, but to no avail. Is there a way?
Regards,
Allen Anderson
AlBruAn Guest
-
DropDownList.SelectedValue not changing
I have a DropDownList that is bound and properly filled from my DataSet when the page loads. but when the I try to retrieve any value I always get... -
Dynamic DropDownList - Retrieving the controls properties(id, selectedindex, etc...)
This is being built on dynamicly based on what is returned from my query. Build in the LoadMain() which is called from the Page_Load. I have built... -
Persisting DDL.SelectedValue or DDL.SelectedItem.Value without Viewstate
Use the forms collection. Something like Request.Form("myDDL") in VB. "Paul Aspinall" <paul@nospamaspy.co.uk> wrote in message... -
Retrieving Mail using ASP
You can use dalun's POP3 or IMAP4 webmail, http://www.dalun.com/ftp/pop3.zip http://www.dalun.com/ftp/imap.zip sources included. "Surya"... -
Retrieving GUID from DB2 UDB
Bill Homan <member35043@dbforums.com> wrote in message news:<3203554.1060104571@dbforums.com>... What is actually in the CHAR(16) FOR BIT DATA... -
Brock Allen #2
Re: Retrieving SelectedValue from DropDownList
> ((DropDownList)(_grid.Items[0].FindControl("cboWorkflowID"))) I can
You're close, but grab the _grid.Item[x].FindControl where x is the row in> think of, but to no avail. Is there a way?
the grid for the footer.
-Brock
DevelopMentor
[url]http://staff.develop.com/ballen[/url]
Brock Allen Guest
-
AlBruAn #3
Re: Retrieving SelectedValue from DropDownList
"Brock Allen" wrote:
Brock,>> > ((DropDownList)(_grid.Items[0].FindControl("cboWorkflowID"))) I can
> > think of, but to no avail. Is there a way?
> You're close, but grab the _grid.Item[x].FindControl where x is the row in
> the grid for the footer.
>
> -Brock
> DevelopMentor
> [url]http://staff.develop.com/ballen[/url]
>
>
I tried (((DropDownList)(_grid.Items[9].FindControl("cboWorkflowID"))) but
it refuses to work since a count of 9 is returned when asking for
_grid.Items.Count.
Allen
AlBruAn Guest
-
Brock Allen #4
Re: Retrieving SelectedValue from DropDownList
Collections are zero-based, so access the position at Count - 1
-Brock
DevelopMentor
[url]http://staff.develop.com/ballen[/url]
> "Brock Allen" wrote:
>> Brock,>> You're close, but grab the _grid.Item[x].FindControl where x is the>>> ((DropDownList)(_grid.Items[0].FindControl("cboWorkflowID"))) I can
>>> think of, but to no avail. Is there a way?
>>>
>> row in the grid for the footer.
>>
>> -Brock
>> DevelopMentor
>> [url]http://staff.develop.com/ballen[/url]
>
> I tried (((DropDownList)(_grid.Items[9].FindControl("cboWorkflowID")))
> but it refuses to work since a count of 9 is returned when asking for
> _grid.Items.Count.
>
> Allen
>
Brock Allen Guest
-
AlBruAn #5
Re: Retrieving SelectedValue from DropDownList
I'm aware collections are zero-based, that's why I said using 9 as in
Items[9] wouldn't work. The footer row is currently the 9th row in the grid,
so your suggestion of using
((DropDownList))(_grid.Items[9].FindControl("cboWorkflowID"))) doesn't work.
Any other idea?
Thanks!
Allen
"Brock Allen" wrote:
> Collections are zero-based, so access the position at Count - 1
>
> -Brock
> DevelopMentor
> [url]http://staff.develop.com/ballen[/url]
>
>
>>> > "Brock Allen" wrote:
> >> > Brock,> >>> ((DropDownList)(_grid.Items[0].FindControl("cboWorkflowID"))) I can
> >>> think of, but to no avail. Is there a way?
> >>>
> >> You're close, but grab the _grid.Item[x].FindControl where x is the
> >> row in the grid for the footer.
> >>
> >> -Brock
> >> DevelopMentor
> >> [url]http://staff.develop.com/ballen[/url]
> >
> > I tried (((DropDownList)(_grid.Items[9].FindControl("cboWorkflowID")))
> > but it refuses to work since a count of 9 is returned when asking for
> > _grid.Items.Count.
> >
> > Allen
> >
>
>
>AlBruAn Guest
-
AlBruAn #6
Re: Retrieving SelectedValue from DropDownList
I'm starting to confuse myself now...LOL. There are currently nine (0
through 8) rows of data, so that would make the footer row the tenth row.
Regardless, _grid.Items.Count returns a value of 9 with the last index being
8, which is to be expected; consequently,
((DropDownList)(_grid.Items[9].FindControl("cboWorkflowID"))) can never
successfully execute, much less return the SelectedValue for that
DropDownList control. So I'm still stuck without a way of finding what value
was selected in the control.
"AlBruAn" wrote:
> I'm aware collections are zero-based, that's why I said using 9 as in
> Items[9] wouldn't work. The footer row is currently the 9th row in the grid,
> so your suggestion of using
> ((DropDownList))(_grid.Items[9].FindControl("cboWorkflowID"))) doesn't work.
> Any other idea?
>
> Thanks!
>
> Allen
>
> "Brock Allen" wrote:
>> > Collections are zero-based, so access the position at Count - 1
> >
> > -Brock
> > DevelopMentor
> > [url]http://staff.develop.com/ballen[/url]
> >
> >
> >> >> > > "Brock Allen" wrote:
> > >
> > >>> ((DropDownList)(_grid.Items[0].FindControl("cboWorkflowID"))) I can
> > >>> think of, but to no avail. Is there a way?
> > >>>
> > >> You're close, but grab the _grid.Item[x].FindControl where x is the
> > >> row in the grid for the footer.
> > >>
> > >> -Brock
> > >> DevelopMentor
> > >> [url]http://staff.develop.com/ballen[/url]
> > > Brock,
> > >
> > > I tried (((DropDownList)(_grid.Items[9].FindControl("cboWorkflowID")))
> > > but it refuses to work since a count of 9 is returned when asking for
> > > _grid.Items.Count.
> > >
> > > Allen
> > >
> >
> >
> >AlBruAn Guest
-
Brock Allen #7
Re: Retrieving SelectedValue from DropDownList
You know what, I think we're mixing topics here. Do you have a DataGrid or
a DataList? A DataGrid doesn't have a FooterTemplate. If it's a DataList
then you just directly use the controls you've declared in there.
-Brock
DevelopMentor
[url]http://staff.develop.com/ballen[/url]
> I'm starting to confuse myself now...LOL. There are currently nine (0
> through 8) rows of data, so that would make the footer row the tenth
> row. Regardless, _grid.Items.Count returns a value of 9 with the last
> index being 8, which is to be expected; consequently,
> ((DropDownList)(_grid.Items[9].FindControl("cboWorkflowID"))) can
> never successfully execute, much less return the SelectedValue for
> that DropDownList control. So I'm still stuck without a way of
> finding what value was selected in the control.
>
> "AlBruAn" wrote:
>>> I'm aware collections are zero-based, that's why I said using 9 as in
>> Items[9] wouldn't work. The footer row is currently the 9th row in
>> the grid, so your suggestion of using
>> ((DropDownList))(_grid.Items[9].FindControl("cboWorkflowID")))
>> doesn't work. Any other idea?
>>
>> Thanks!
>>
>> Allen
>>
>> "Brock Allen" wrote:
>>>>> Collections are zero-based, so access the position at Count - 1
>>>
>>> -Brock
>>> DevelopMentor
>>> [url]http://staff.develop.com/ballen[/url]
>>>> "Brock Allen" wrote:
>>>>
>>>>>> ((DropDownList)(_grid.Items[0].FindControl("cboWorkflowID"))) I
>>>>>> can think of, but to no avail. Is there a way?
>>>>>>
>>>>> You're close, but grab the _grid.Item[x].FindControl where x is
>>>>> the row in the grid for the footer.
>>>>>
>>>>> -Brock
>>>>> DevelopMentor
>>>>> [url]http://staff.develop.com/ballen[/url]
>>>> Brock,
>>>>
>>>> I tried
>>>> (((DropDownList)(_grid.Items[9].FindControl("cboWorkflowID"))) but
>>>> it refuses to work since a count of 9 is returned when asking for
>>>> _grid.Items.Count.
>>>>
>>>> Allen
>>>>
Brock Allen Guest



Reply With Quote

