I have a webhierarchial data grid. I'm loading the grid on page load. But the criteria based(cost/hous) loading of parent row is getting loaded on the first time. When i set default as Cost/ hours in aspx. When I change the criteria and click refresh the parent row is not pulling based on the criteria/ it is not refreshing. But when I tried to view the child row, it is getting the matched criteria. The parent row is still cost based but the child row is hours based. I'm also trying to manipuating the column names also, but that is also not working based on the criteria. I have tried ClearTemplates, refreshbehaviors but nothing seems to help.
<
asp:UpdatePanel ID="UpdatePanel1" runat
="server">
<ContentTemplate>
<ig:WebHierarchicalDataGrid ID="hdgResourceAllocation" runat="server" Height="400px"
Width="100%" AutoGenerateColumns="false" AutoGenerateBands="false" DataKeyFields="RowId"
InitialDataBindDepth="0" EnableDataViewState="false" EnableAjaxViewState="false" >
<ClientEvents Initialize="showToolTip" />
<Columns>
<ig:BoundDataField DataFieldName="RowId" Key="RowId" Hidden="true" />
<ig:BoundDataField DataFieldName="ResourceName" Key="ResourceName" Header-Text="Resource Name"
Width="150" />
<ig:BoundDataField DataFieldName="ProjectName" Key="ProjectName" Header-Text="Project Name"
<ig:BoundDataField DataFieldName="ForecastMonth" Key="ForecastMonth" Header-Text="Forecast Month"
Width="70" />
<ig:BoundDataField DataFieldName="RowTotalHours1" Key="RowTotalHours1"
DataFormatString="{0:N2}" Width="100" Header-CssClass="HeaderRight" CssClass="AlignRight" />
<ig:BoundDataField DataFieldName="RowTotalHours2" Key="RowTotalHours2"
<ig:BoundDataField DataFieldName="RowTotalHours3" Key="RowTotalHours3"
<ig:BoundDataField DataFieldName="RowTotalHours4" Key="RowTotalHours4"
<ig:BoundDataField DataFieldName="RowTotalHours5" Key="RowTotalHours5"
<ig:BoundDataField DataFieldName="RowTotalHours6" Key="RowTotalHours6"
<ig:BoundDataField DataFieldName="RowTotalHours7" Key="RowTotalHours7"
<ig:BoundDataField DataFieldName="RowTotalHours8" Key="RowTotalHours8"
<ig:BoundDataField DataFieldName="RowTotalHours9" Key="RowTotalHours9"
<ig:BoundDataField DataFieldName="RowTotalHours10" Key="RowTotalHours10"
<ig:BoundDataField DataFieldName="RowTotalHours11" Key="RowTotalHours11"
<ig:BoundDataField DataFieldName="RowTotalHours12" Key="RowTotalHours12"
<ig:BoundDataField DataFieldName="RowTotalHours13" Key="RowTotalHours13"
<ig:BoundDataField DataFieldName="RowTotalCharge1" Key="RowTotalCharge1"
<ig:BoundDataField DataFieldName="RowTotalCharge2" Key="RowTotalCharge2"
<ig:BoundDataField DataFieldName="RowTotalCharge3" Key="RowTotalCharge3"
<ig:BoundDataField DataFieldName="RowTotalCharge4" Key="RowTotalCharge4"
<ig:BoundDataField DataFieldName="RowTotalCharge5" Key="RowTotalCharge5"
<ig:BoundDataField DataFieldName="RowTotalCharge6" Key="RowTotalCharge6"
<ig:BoundDataField DataFieldName="RowTotalCharge7" Key="RowTotalCharge7"
<ig:BoundDataField DataFieldName="RowTotalCharge8" Key="RowTotalCharge8"
<ig:BoundDataField DataFieldName="RowTotalCharge9" Key="RowTotalCharge9"
<ig:BoundDataField DataFieldName="RowTotalCharge10" Key="RowTotalCharge10"
<ig:BoundDataField DataFieldName="RowTotalCharge11" Key="RowTotalCharge11"
<ig:BoundDataField DataFieldName="RowTotalCharge12" Key="RowTotalCharge12"
<ig:BoundDataField DataFieldName="RowTotalCharge13" Key="RowTotalCharge13"
<ig:BoundDataField DataFieldName="ForecastStatus" Key="ForecastStatus" Header-Text="Forecast Status"
Width="100" />
<ig:BoundDataField DataFieldName="ProjectForecaster" Key="ProjectForecaster" Header-Text="Forecaster"
Width="90" />
<ig:BoundDataField DataFieldName="ProjectTechnologyPM" Key="ProjectTechnologyPM"
Header-Text="Technology PM" Width="90" />
</Columns>
<EmptyRowsTemplate>
<b>No records were found.</b>
</EmptyRowsTemplate>
<Bands>
<ig:Band AutoGenerateColumns="false" DataMember="SubRows" Key="SubRowId" DataKeyFields="SubRowId" ShowHeader="false">
<ig:BoundDataField DataFieldName="SubRowId" Key="SubRowId" Hidden="true" />
<ig:BoundDataField DataFieldName="ProjectNumber" Key="ProjectNumber" Header-Text="Project Number"
Width="125" />
</ig:Band>
</Bands>
<Behaviors>
<ig:Sorting Enabled="false" SortingMode="Single" />
<ig:Selection CellClickAction="Row" RowSelectType="Single" CellSelectType="None" />
</Behaviors>
</ig:WebHierarchicalDataGrid>
</ContentTemplate>
</asp:UpdatePanel>
protected
override void Page_Load(object sender, EventArgse)
{
if(!IsPostBack)
base.Page_Load(sender, e);
txtLraVariance.Text =
"5";
ViewState[
"ActiveForecast"]=UserSession.ActiveForecastId;
}
PopulateResourceAllocation();
private void PopulateResourceAllocation()
List<ForecastResourceAllocation> obj = new List<ForecastResourceAllocation>();
obj=
ForecastBusinessTier.GetForecastResourceAllocation(Convert.ToInt64(UserSession.ActiveForecastId));
if(obj.Count>0)
hdgResourceAllocation.RefreshBehaviors();
SetResourceAllocationColumnHeaders();
HideResourceAllocationColumns();
hdgResourceAllocation.DataSource = obj;
hdgResourceAllocation.DataBind();
protected void SetResourceAllocationColumnHeaders()
//hide hours/cost columns based on the selection
// Change column header month values based on the selected forecast month
// Forecast forecast = (Forecast)ViewState["ActiveForecast"];
int colStart = 4;
DateTime datCounter = Convert.ToDateTime("12/01/2012");
if (colStart > 0)
int j = 1;
for (int i = colStart; i < this.hdgResourceAllocation.Columns.Count - 3; i++)
if (radForecastCost.Checked)
if (i <= 16)
hdgResourceAllocation.Columns[i].Hidden =
true;
hdgResourceAllocation.Bands[0].Columns[i].Hidden =
else
false;
if (j <= 13 && !hdgResourceAllocation.Columns[i].Hidden)//fiscalyear in months
string temp = datCounter.ToString("MMM yyyy");
hdgResourceAllocation.Columns[i].Header.Text = temp;
hdgResourceAllocation.Bands[0].Columns[i].Header.Text = temp;
datCounter = datCounter.AddMonths(1);
j++;
if (i > 16 && i < 30)
string temp = datCounter.ToString("dd MMM yyyy");
//forecast = null;
voidHideResourceAllocationColumns()
// hide columns for months that occur before the forecast month being displayed
for (int i = 4; i < this.hdgResourceAllocation.Columns.Count - 2; i++)
DateTime datTemp;
if (DateTime.TryParse(hdgResourceAllocation.Columns[i].Header.Text, out datTemp))
if (datTemp < UserSession.ActiveForecastDate)
protected void btnLraRefresh_Click(object sender, EventArgs e)
Hello ga48,
In this scenario I would suggest trying to call the RequestFullAsyncRender() method of the grid to check whether this makes a difference with hiding/showing desired column. As a test it may also help removing the update panel wrapping the grid to see if any changes occur. In order to allow me to research this in more detail, a small working sample demonstrating the issue would be greatly appreciated.
Thanks for helping me out. I have changed my logic to load the grid data based on each criteria. I used only one column RowTotalx, the values will be populated either based on hours / cost from the stored procedure based on hours/cost selected. This way i don't need to hide all the cost columns / hours column. I will try your method in a sample.
Thank you for your reply. The approach mentioned for populating based on the stored procedure to avoid hiding and showing columns seems appropriate in this scenario. Please do not hesitate to contact me if any questions arise.
Hi Ivanov,
Please hlep me on the below issue. I'm struglling for past 3 days and unable to get a solution.
Thanks,
Agilan G
No Thanks. I have figured it out. I wrote the below statement in InitializeRow event of the grid. set a hidden variable to check , if the statement is already executed.
Hidden variables are ResourceName, ResourceNameType which is set in the webdialogwindow OK click event. Mapping those values to the container
ContainerGrid grid = hdgForecastDetails.GridView;
if (string.IsNullOrEmpty(ResourceName.Value))
ResourceName.Value =
"Select Resource";
grid.Behaviors.EditingCore.Behaviors.RowAdding.Row.Items[1].Text = ResourceName.Value;
grid.Behaviors.EditingCore.Behaviors.RowAdding.Row.Items[4].Text = ResourceNameType.Value;
Hello Agilan,
Apologies for the late reply and thank you for sharing your solution ! Glad that you were able to implement your requirement.
Please feel free to contact me if any additional questions arise.