Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Linkbutton Inside Gridview Not Firing Server Side Code

Posted on 2009-07-15
2
Medium Priority
?
487 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 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
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 …
Despite its rising prevalence in the business world, "the cloud" is still misunderstood. Some companies still believe common misconceptions about lack of security in cloud solutions and many misuses of cloud storage options still occur every day. …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

916 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