Solved

Adding a link button or hyperlink in gridview

Posted on 2013-01-25
3
312 Views
Last Modified: 2013-01-25
I have a gridview that has  drop down defined.  I am having trouble binding a datasource to the dropdown.  

The UI Code and Code Behind code  is attached.  

At the line

drp.DataSource = ds

I am getting an object reference error.  Can someone please help with this.

Thanks.
gridviewdropdown.txt
0
Comment
Question by:sherbug1015
3 Comments
 
LVL 83

Assisted Solution

by:CodeCruiser
CodeCruiser earned 250 total points
ID: 38819301
>drp = DirectCast(RowItem.Cells(0).FindControl("ddlCadence"), DropDownList)

Above line is not working. Its not finding the drop down list.

Should it not be

drp = DirectCast(RowItem.Cells(1).FindControl("ddlCadence"), DropDownList)
0
 

Author Comment

by:sherbug1015
ID: 38819379
Still throwing the same object reference error
0
 
LVL 41

Accepted Solution

by:
guru_sami earned 250 total points
ID: 38819407
Where is your vb code block called?

1: You should do the Dropdown databinding in the GridView RowDataBound

For the error...instead of finding in the cell just find in the rowItem

drp = DirectCast(RowItem.FindControl("ddlCadence"), DropDownList)

Open in new window

0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Initial get page response times and IIS8 15 51
application restarter  - for an exe that hangs 9 28
Store results in vb.net 3 22
How come this regular expression allows "e"? 14 38
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

831 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