Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   Re: need selected value from dropdown list box (http://www.velocityreviews.com/forums/t85520-re-need-selected-value-from-dropdown-list-box.html)

Scott Allen 08-25-2004 05:55 PM

Re: need selected value from dropdown list box
 
Hi Paul:

I have some code to demonstrate how to do this about half way through
the following article:
http://odetocode.com/Articles/116.aspx

HTH,

--
Scott
http://www.OdeToCode.com

On Wed, 25 Aug 2004 09:19:14 -0700, "Paul"
<Paul@discussions.microsoft.com> wrote:

>Hi just wondering how to get the selected value from a dropdown list box in a
>template column of a datagrid? I set up the DataGrid1_ItemCommand method and
>put a breakpoint in it but after making a selection from the dropdown list
>box the breakpoint is not hit.
>Thanks.



Scott Allen 08-25-2004 07:09 PM

Re: need selected value from dropdown list box
 
Hi Paul:

This is the SelectedIndexChanged event handler for the DropDownList?
This should work, if AutoPostBack is set to true for the DropDownList.

Also, I'm not sure if DataGrid1.SelectedIndex will be current with
where the user changed the DropDownList. You might have to work up the
DropDownList object's Parent property till you get to the
DataGridItem, then use FindControl to get the TextBox.

Hope makes some sense...

--
Scott
http://www.OdeToCode.com



On Wed, 25 Aug 2004 11:15:09 -0700, "Paul"
<Paul@discussions.microsoft.com> wrote:

>Hi Scott, thanks for the information. I think I found the code you were
>talking about, see below. I have a Selected inex change method but can not
>get the event to fire, part of the grid is databound (just displays data from
>a dbase) and other columns are dropdown list boxes. I was hoping this event
>would fire when the user made a selection in the dropdown list box, (template
>column of the grid).
>private void DataGrid1_SelectedIndexChanged(object sender, System.EventArgs e)
>{
> TextBox b;
> b = DataGrid1.Items[DataGrid1.SelectedIndex].FindControl("TextBox1") as
>TextBox;
> if(b != null)
> {
> Response.Write("Sender = " + sender.GetType().ToString() + "<br>");
> Response.Write("Found Textbox1 in SelectedIndexChanged event<br>");
> Response.Write(FindUtil.DumpParent(b));
> }
>}
>
>
>
>"Scott Allen" wrote:
>
>> Hi Paul:
>>
>> I have some code to demonstrate how to do this about half way through
>> the following article:
>> http://odetocode.com/Articles/116.aspx
>>
>> HTH,
>>
>> --
>> Scott
>> http://www.OdeToCode.com
>>
>> On Wed, 25 Aug 2004 09:19:14 -0700, "Paul"
>> <Paul@discussions.microsoft.com> wrote:
>>
>> >Hi just wondering how to get the selected value from a dropdown list box in a
>> >template column of a datagrid? I set up the DataGrid1_ItemCommand method and
>> >put a breakpoint in it but after making a selection from the dropdown list
>> >box the breakpoint is not hit.
>> >Thanks.

>>
>>




All times are GMT. The time now is 07:15 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.