Click here to Skip to main content
15,885,767 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using a Gridview and placing a button inside the header template.
But i am unable to get it's click event. Can anyone look into it and guide me? My code is:
<asp:gridview id="gvReviewRequest" allowpaging="True" onrowcommand="ProductsGridView_RowCommand" xmlns:asp="#unknown">
            AutoGenerateColumns="False" runat="server"&gt;
            <columns>
                <asp:templatefield headertext="Price">
                    <itemtemplate>
                         <asp:label id="lblStatus" runat="server" text="&lt;%# Eval("Status") %&gt;"></asp:label>
                    </itemtemplate>
                </asp:templatefield>
                <asp:templatefield>
                <headertemplate>
                <asp:button runat="server" id="IncreaseButton" text="Increase Price 5%" commandname="Increase">
                           /&gt;
                </asp:button></headertemplate>
                    <itemtemplate>
                        
                    </itemtemplate>
                </asp:templatefield>
            </columns>
        </asp:gridview>
Posted
Updated 23-Jun-10 22:20pm
v2
Comments
Ankur\m/ 24-Jun-10 6:25am    
The link given by sainath437 was not pasted properly. I have fixed it. You can use it now.

Go through the below link for gridview having a button in the footer.....
the link is working for me.
www.aspsnippets.com/Articles/Adding-Dynamic-Rows-in-ASP.Net-GridView-Control-with-TextBoxes.aspx[^]
Just type in the google Adding Dynamic Rows in ASP.Net GridView Control with TextBoxes aspsnippets.com
 
Share this answer
 
v6
Comments
Mani1981 24-Jun-10 4:32am    
This page is not avaialble anymore. can u provide me wth sm other link:
Thanks
Ankur\m/ 24-Jun-10 6:24am    
You didn't paste the link properly. So it was not working. I have fixed it now.
You can also directly give click event for button,

XML
<asp:button runat="server" id="IncreaseButton" text="Increase Price 5%" OnClick="btn_Click" 


Can you try this way
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900