Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1790
Loading WHDG in code behind and I need to hide a column in the band.
posted

I have a WHDG that I load from one dataset that has two tables.  I have autogeneratebands=true.  I cannot seem to hide the id column, which I need that value when using a hyperlink, which I also need to add in code behind.  The WHDG loads fine and so do the bands, I haven't even tried to add a template field yet.  I have tried to hide the first two columns in the band to no avail.  I have tried the RefreshBehaviors in the DataBound event after the rowisland.maingrid.columns[0].hidden=true; and I get an error like 'script controls may not be registered after pre-render.

I can't figure out how to hide a couple of the columns in my band.  I have tried to create the columns in html and setting autogeneratebands=false but  the bands will not load.

    protected void Page_Load(object sender, EventArgs e)

 {

        btnQuestEditor.Click += new EventHandler(btnQuestEditor_Click);

        if (!IsPostBack)

        {

            ddlPOPYear.DataBind();

            ddlPOPYear.SelectedValue = DateTime.Now.Year.ToString();

        }

        this.whdgDefault.DataSource = GetDefaultDataSet();

        this.whdgDefault.RowIslandDataBinding += new RowIslandEventHandler(whdgDefault_RowIslandDataBinding);

        this.whdgDefault.RowIslandDataBound += new RowIslandEventHandler(whdgDefault_RowIslandDataBound);

        whdgDefault.DataBind();

     }

 

    private object GetDefaultDataSet()

    {

        string[] m = new string[] { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"};

        IList<POP> pCollection = new List<POP>();

        pCollection = POP.GetPOPsByYear(Convert.ToInt32(ddlPOPYear.SelectedValue));

        DataSet ds = new DataSet("FYPOPs");

        

        DataTable dtPOPs = new DataTable("ParentPOPs");

        dtPOPs.Columns.Add("POPID", typeof(Guid));

        dtPOPs.Columns.Add("POPMonth", typeof(string));

 

        foreach(POP p in pCollection)

        {

 

            dtPOPs.Rows.Add(new object[] {p.POPID, m[p.POPMonth - 1]});

        }

        dtPOPs.PrimaryKey = new DataColumn[]{dtPOPs.Columns[0]};

 

        DataTable dtQAMRs = new DataTable("QAMRs");

        dtQAMRs.Columns.Add("POPID", typeof(Guid));

        dtQAMRs.Columns.Add("QAMRID", typeof(Guid));

        dtQAMRs.Columns.Add("Title", typeof(string));

 

        foreach(POP p in pCollection)

        {

            foreach(QAMR q in p.POPQAMRS)

            {

                dtQAMRs.Rows.Add(new object[] {p.POPID, q.QAMRID, q.Title});

            }

        }

        dtQAMRs.PrimaryKey = new DataColumn[]{dtQAMRs.Columns[1]};

 

        ds.Tables.Add(dtPOPs);

        ds.Tables.Add(dtQAMRs);

 

        ds.Relations.Add("relPOPQAMR", dtPOPs.Columns["POPID"], dtQAMRs.Columns["POPID"]);

 

        return ds;

    }

 

<ig:WebHierarchicalDataGrid ID="whdgDefault" runat="server" 
         AutoGenerateColumns="false" AutoGenerateBands="true" InitialDataBindDepth="1"  DataKeyFields="POPID"            
          Width="900px"  >              
         <ExpandCollapseAnimation SlideOpenDirection="Auto" SlideOpenDuration="300" SlideCloseDirection="Auto" SlideCloseDuration="300" />             
         <Columns>                 
                 <ig:BoundDataField DataFieldName="POPID" Key="POPID" Hidden="true" />                 
                 <ig:BoundDataField DataFieldName="POPMonth" Key="POPMonth" Header-Text="Month" />                 
         </Columns>             
         </ig:WebHierarchicalDataGrid>

 Can you tell me what I am need to do?

Parents Reply Children
No Data