Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > How to use a DropDownList in a GridView?

Reply
Thread Tools

How to use a DropDownList in a GridView?

 
 
S_K
Guest
Posts: n/a
 
      09-27-2007
I have a GridView that has a DropDownList in one of the columns.
When I edit and update any row I would like to grab the SelectedValue
of that DropDownList when I'm in the GridView_RowUpdating event.

Any ideas?

 
Reply With Quote
 
 
 
 
=?Utf-8?B?TWFuaXNo?=
Guest
Posts: n/a
 
      09-28-2007
Hi,

You can refer to the following code to get the SelectedValue of the
DropDownList in the GridView_RowUpdating event.

Protected Sub GridView1_RowUpdating(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles
GridView1.RowUpdating
Dim s As String =
CType(GridView1.Rows(e.RowIndex).FindControl("Drop DownList1"),
DropDownList).SelectedValue.ToString()
Response.Write(s)
End Sub

Hope this helps.

Regards,
Manish

"S_K" wrote:

> I have a GridView that has a DropDownList in one of the columns.
> When I edit and update any row I would like to grab the SelectedValue
> of that DropDownList when I'm in the GridView_RowUpdating event.
>
> Any ideas?
>
>

 
Reply With Quote
 
 
 
 
=?Utf-8?B?TWFuaXNo?=
Guest
Posts: n/a
 
      09-28-2007
Hi,

If you also want to know how you can use the DropDownList control in
GridView control then you can add a TemplateField in the GridView control and
then add the DropdwonList control in the ItemTemplate of that template column.

Regards,
Manish

You can also

"S_K" wrote:

> I have a GridView that has a DropDownList in one of the columns.
> When I edit and update any row I would like to grab the SelectedValue
> of that DropDownList when I'm in the GridView_RowUpdating event.
>
> Any ideas?
>
>

 
Reply With Quote
 
S_K
Guest
Posts: n/a
 
      09-28-2007
On Sep 28, 12:48 am, Manish <(E-Mail Removed)> wrote:
> Hi,
>
> If you also want to know how you can use the DropDownList control in
> GridView control then you can add a TemplateField in the GridView control and
> then add the DropdwonList control in the ItemTemplate of that template column.
>
> Regards,
> Manish
>
> You can also
>
>
>
> "S_K" wrote:
> > I have a GridView that has a DropDownList in one of the columns.
> > When I edit and update any row I would like to grab the SelectedValue
> > of that DropDownList when I'm in the GridView_RowUpdating event.

>
> > Any ideas?- Hide quoted text -

>
> - Show quoted text -


Thanks that worked!

Steve

 
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
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
GridView: Filter DropDownList for another DropDownList =?Utf-8?B?SnVhbmpv?= ASP .Net 0 12-29-2005 07:44 AM
GridView: Filtr DropDownList from another DropDownList =?Utf-8?B?SnVhbmpv?= ASP .Net 0 12-23-2005 01:31 PM
databinding a Dropdownlist to another dropdownlist tshad ASP .Net 8 10-19-2005 10:00 PM
Using a data-bind dropdownlist to populate another data-bind dropdownlist mr2_93 ASP .Net 1 10-02-2005 05:07 PM



Advertisments