We're a community of 1077K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,076,473 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Buttons in gridview not working

I have a template field in my gridview which holds a button for each row, however when I test it to see if it's working it doesn't do anything, the page just reloads but nothing has happened. What I want the button to do in the end is to unlock a user. At the minute I'm testing it by having a panel appear if the button is clicked.

  <asp:TemplateField>
                <ItemTemplate>
                    <asp:Button ID="btnUnlock" runat="server" CommandArgument='<%# Eval("UserId") %>'
                        CommandName="Select" Text="Unlock" OnCommand="btnUnlock_Command"/>
                </ItemTemplate>
            </asp:TemplateField>

This is the part of the gridview for the button, not sure for the code behind should I use the button onCommand method or gridview rowCommand method?

2
Contributors
2
Replies
22 Hours
Discussion Span
2 Months Ago
Last Updated
13
Views
coder91
Junior Poster in Training
94 posts since Oct 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

This is the part of the gridview for the button, not sure for the code behind should I use the button onCommand method or gridview rowCommand method?

Didn't someone already explain how to unlocked it:

http://www.daniweb.com/web-development/aspnet/threads/448833/gridview-to-unlock-users

Does the query work for here:

http://www.daniweb.com/web-development/databases/threads/448922/sql-code-to-get-information-from-three-tables

LastMitch
Industrious Poster
4,212 posts since Mar 2012
Reputation Points: 134
Solved Threads: 336
Skill Endorsements: 45

Yes but this was a different problem I was having with the page. Was able to sort it, just needed a clean refresh of the page.

coder91
Junior Poster in Training
94 posts since Oct 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0738 seconds using 2.7MB