Solved

Linkbutton Inside Gridview Not Firing Server Side Code

Posted on 2009-07-15
2
480 Views
Last Modified: 2012-05-07
Please see me code below.

I've debugged and set a breakpoint on the  gvProds_RowCommand subroutine and it's not hitting it.

Any ideas?
<asp:GridView ID="gvProds" runat="server" BackColor="#EEEEEE" GridLines="horizontal" AllowSorting="false" CssClass="TextLabel" Width="780px"

AutoGenerateColumns="false" DataKeyNames="key" EnableViewState="false" >

<SelectedRowStyle BackColor="LightYellow" Font-Bold="true" />

<HeaderStyle BackColor="LightSlateGray" ForeColor="White" />

<AlternatingRowStyle BackColor="#DDDDDD" Font-Bold="false" />

<RowStyle Font-Bold="false" />                                

<Columns>                                                                        

<asp:TemplateField>

<ItemTemplate>

<asp:LinkButton ID="lnkDetails" runat="server" Text="Details." CommandArgument='<%# eval("key") %>' CommandName="select" CausesValidation="false">								  </asp:LinkButton>

</ItemTemplate>

</asp:TemplateField>

</Columns>                                                        

</asp:GridView>
 

                       
 
 
 

    Protected Sub gvProds_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles gvProds.RowCommand
 

        If e.CommandName = "select" Then

            Me.hdnSelectedItem.Value = CType(sender, GridView).DataKeys(e.CommandArgument).Value

            SetMenuOptions(1)

        End If
 

    End Sub

Open in new window

0
Comment
Question by:synapse88
2 Comments
 
LVL 11

Accepted Solution

by:
b_levitt earned 500 total points
ID: 24862738
you could try wiring the even in the tag:
<asp:GridView onrowcommand="gvProds_RowCommand"...

Are you binding the grid without a if(!IsPostBack) check?  If so try that or bind the grid in prerender instead.

ViewState turned off somewhere?
0
 

Author Comment

by:synapse88
ID: 24863420
It was view state, thanks!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…
Delivering innovative fully-managed cloud services for mission-critical applications requires expertise in multiple areas plus vision and commitment. Meet a few of the people behind the quality services of Concerto.

948 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

23 Experts available now in Live!

Get 1:1 Help Now