Solved

Linkbutton Inside Gridview Not Firing Server Side Code

Posted on 2009-07-15
2
483 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

Webinar: Aligning, Automating, Winning

Join Dan Russo, Senior Manager of Operations Intelligence, for an in-depth discussion on how Dealertrack, leading provider of integrated digital solutions for the automotive industry, transformed their DevOps processes to increase collaboration and move with greater velocity.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Visual Studio npm 1 29
Need help converting bitmap to image in VB.Net 8 45
vb.net convert long time to mm:ss 23 21
T-SQL and CLR parameter strings 9 24
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

749 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