Click here to Skip to main content
15,892,674 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I use render to click the row in gridview.i need,if i click the one row ,gridview header should be hide.
Posted
Updated 17-Feb-13 22:41pm
v2
Comments
Sandeep Mewara 18-Feb-13 4:35am    
This is not a well framed question! We cannot work out what you are trying to do/ask from the post. Please elaborate and be specific.
Use the "Improve question" link to edit your question and provide better information.

1 solution

XML
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
        onrowcommand="GridView1_RowCommand" >
        <Columns>
            <asp:BoundField DataField="UNIT" HeaderText="UNIT" />
            <asp:BoundField DataField="AMT" HeaderText="AMT" />
            <asp:TemplateField HeaderText="UP">
            <ItemTemplate>
            <asp:Button ID="C" runat="server" Text="DDD" />
            </ItemTemplate>
            </asp:TemplateField>
        </Columns>
</asp:GridView>


C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
           //GridView CODE//
        }

    }
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        if (GridView1.HeaderRow.Visible == true)
        {
            GridView1.HeaderRow.Visible = false;
        }
        else
        {
            GridView1.HeaderRow.Visible = true;
        }
    }
}
 
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