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(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?
Hello nbizub,
I have been looking into your issue and I can suggest you check the following link from our documentation where you can find more details about hiding of columns in our WebHierarchicalDataGrid:
http://help.infragistics.com/Help/NetAdvantage/ASPNET/2012.1/CLR4.0/html/WebHierarchicalDataGrid_Hide_a_Column.html
Furthermore I create a small sample for you in order to show you this functionality implemented through java script. For additional reference on this please find the attached sample
If you need any further assistance on this matter feel free to ask.
Hi. I am able to get the columns hidden now, but it changes the style/width that I have set on the whdgGrid. Please see the attached image. Also, the codebehind sample C# doesn't show how to get the the child columns. I can't seem to find the child or band columns in code behind. And I can't find the style/width attribute of the whdg in javascript.
Can you tell me how to reset the whdg width in javascript and/or how to get to the child columns in c# code behind? Do I do the hidden in the databound event?
Thanks.
I am just checking have you been able to resolve your issue? If you still need any assistance on the matter do not hesitate to ask.