Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Linkbutton Inside Gridview Not Firing Server Side Code

Posted on 2009-07-15
2
Medium Priority
?
486 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 11

Accepted Solution

by:
b_levitt earned 2000 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

What is a Denial of Service (DoS)?

A DoS is a malicious attempt to prevent the normal operation of a computer system. You may frequently see the terms 'DDoS' (Distributed Denial of Service) and 'DoS' used interchangeably, but there are some subtle differences.

Question has a verified solution.

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

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

704 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