python ruby-programming-language Smalltalk Vue.js Knockoutjs TypeScript JavaScript, OOPs JavaScript Angular 8,7,6,5,4 and 2 Interview Questions and Answers Angular 8,7,6,5,4 and 2 Interview Questions and Answers Angular 4 Angular 2 AngularJs 1.x NodeJs Perl Programming R Programming RequireJs Rust Programming Backbonejs closure programming language go-programming-language kotlin-programming-language
Hide Gridview column at Runtime in ASP .net.

Hide Gridview column at Runtime in ASP .net.

Hello Everyone,

In this post going to share to code-sample for the hide gridview column at run-time using asp.net with c#

Table of Contents

1. In the 1st steps, code-sample for collection class for returns dataSet.
2. In the 2nd steps, code-sample for bind the grid view and hide row from grid view at the run time.

In the step 1st

/// <summary>
/// Collection Class is used to return dataset.
/// </summary>
public class CollectionClass
{
    /// <returns>DataSet</returns>
    public DataSet GetVideofile()
    {
        DataSet dsVideo = null;
        string spNamehere = "sp_getCWVideos";
        Hashtable paramTable = new Hashtable();
        dsVideo = System.Web.DataAccess.ExecuteSP(spNamehere, paramTablehere);
        return dsVideo;
    }
}

In the step 2nd

/// <summary>
/// Page load event is used to bind the data sourses.
/// </summary>
protected void Page_Load(object sender, EventArgs e)
{
    try
    {
        CollectionClass objcollcls = new CollectionClass();
        GridViewID.DataSource = objcollcls.GetVideofile();
        GridViewID.DataBind();

        GridViewID.HeaderRow.Cells[5].Visible = false;
        foreach (GridViewRow objgvr in GridViewID.Rows)
        {
            objgvr.Cells[5].Visible = false;
        }
    }
    catch (Exception ex)
    {
        lblMessagetext.Text = ex.Message;
    }
}


ANIL SINGH

Hi there! Welcome to my blog. My name is Anil Singh. I'm a author of this blog. For more detail about me, kindly refer to this link..
My Blogs - http://code-sample.com and http://code-sample.xyz
My Books - Interview Questions and Answers Books- Get Your Book in 15+ Digital Stores Worldwide..

You Might Also Like
www.code-sample.com/. Powered by Blogger.
ASK Questions