?
Solved

Capturing the selected index of a dropdown in the gridview

Posted on 2013-01-26
1
Medium Priority
?
617 Views
Last Modified: 2013-01-26
I have a dropdown inside of a gridview.  The user will select an item from the dropdown and click a link button (also inside the gridview).  

I am capturing the click event in the gridview's  RowCommand, but I also need to capture the value of the dropdown from the clicked row to pass to the next page.  

I tried this from the Rowcommand event, but I am getting an error.  

Dim ddl As DropDownList = TryCast(e.Row.FindControl("ddlCadence"), DropDownList)

Can someone help, please.

Thank you
0
Comment
Question by:sherbug1015
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 7

Accepted Solution

by:
Element1910 earned 2000 total points
ID: 38822522
What error are you getting??

You could try this in the meantime...add a OnSelectedIndexChanged event to your dropdownlist:
OnSelectedIndexChanged="ddlCadence_SelectedIndexChanged"

Open in new window

Then to capture the selected value:
Protected Sub ddlCadence_SelectedIndexChanged(sender As Object, e As EventArgs)
	Dim gv1 As GridViewRow = DirectCast(DirectCast(sender, Control).NamingContainer, GridViewRow)
	Dim ddl As DropDownList = DirectCast(gv1.FindControl("ddlCadence"), DropDownList)
	TextBox1.Text = ddl.SelectedItem.Value
End Sub

Open in new window

0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Suggested Courses

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question