[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Converting a datagrid BoundColumn to a LinkButton

Posted on 2006-05-24
Medium Priority
Last Modified: 2012-05-05
I have a datagrid that is dynamically built from a query. The number of columns will always be at least 2.

When my results are bound, how can I make the cells in columns 3 onwards, linkbuttons, rather than bound columns? I know I should do it in the ItemDataBound event, but it's the actual conversion of the cell I am having.
Question by:Craig_Muckleston
  • 3
LVL 18

Accepted Solution

Elvio Lujan earned 150 total points
ID: 16751784
in the itemDataDound event:

e.Item.Cells(3).Text = "<a href='xxx.aspx'>text</a>"

Author Comment

ID: 16758775
Hi lem2802,

Doesn't this turn it into a hyperlink though? What I want to do is have the linkbutton so that I can drill down into the datagrid without passing the user to another page.


Author Comment

ID: 16759764

I've managed to create the link buttons, but I can;t get any of it's events to fire...

lnkBtn = New LinkButton
                strColVal = e.Item.Cells(3).Text
                With lnkBtn
                    .Text = strColVal
                    .Visible = True
                    .CommandName = "drill"
                    .CommandArgument = strColVal
                    .Enabled = True
                    .EnableViewState = True
                End With

Expert Comment

ID: 16768816
Edit the BoundColumn AND change it to Template
In template you can do what ever you want.

Hint using ur solution:
Did you declare the CommandName ="drill" and catch it in OnItemCommand ?

Author Comment

ID: 16797457
HI lem2802,

I have used your solution and passed params to another page. This works fine. I was looking for a way to do it in one page to be honest, but at least it works.

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

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…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…
Suggested Courses

872 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