Solved

Adding a link button or hyperlink in gridview

Posted on 2013-01-25
3
314 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!

697 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