Solved

Add parameters to LinkButton

Posted on 2014-01-29
2
271 Views
Last Modified: 2014-01-29
Might not even be doing this correctly so I'll explain what I'm trying to do. Very simply I'm trying to create a GridView and within this I will have a button. This button will have some additional parameters added to it (namely an ID) so I would suspect it would look something like #/volunteer.aspx?ID=000000 (with the actual ID added to the end of the link)

So I have my code like this:
<asp:TemplateField>
                                    <ItemTemplate>
                                        <asp:LinkButton runat="server" ID="NewViewReports" CommandName="ViewReports" CommandArgument='<%# Eval("CRM_BusinessGUID", "~/Volunteer.aspx?ID={0}") %>' CssClass="btn btn-primary btn-large" Text="New View Reports &raquo;" />
                                    </ItemTemplate>
                                </asp:TemplateField

Open in new window

and although the button is created correctly the links are not there but the HTML looks like this:
<a class="btn btn-primary btn-large" id="MainContent_ctl00_GridView1_NewViewReports_0" href="javascript:__doPostBack('ctl00$MainContent$ctl00$GridView1$ctl02$NewViewReports','')">New View Reports »</a>

Open in new window

Hopefully this is an easy one to sort and I've explained what I'm after so appreciate any advice you guys can offer.

Thanx again
0
Comment
Question by:Steven O'Neill
2 Comments
 
LVL 4

Accepted Solution

by:
ItWorked earned 500 total points
Comment Utility
The reason is you have placed the LinkButton in GridView and the URL that you have plaved is as CommandArgument.

If you need to have just a redirect then you can put the same code for
NavigationURL

Open in new window


If you want to work otherway,
 you need to handle RowCommandEvent of GridView. Where you'll check commandname by e.CommandName=="ViewReports"
and redirect to page by using
e.CommandArgument

Open in new window


Hope this will help
0
 
LVL 2

Author Closing Comment

by:Steven O'Neill
Comment Utility
Ok being very thick here lol...that's sorted my issue but should've known that one.

Ended up using the NavigateUrl method

Thanx again
0

Featured Post

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

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…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

744 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now