I need to access a gridview datacolumn in code behind to bind the data ( my BDO object), set the header text and for some other reasons as my application is supposed to be highly configurable. I have a method that performs all these things and it takes GridViewDataColumn as one of the parameters but when I am calling this method, passing "x:Name" of the column it comes as null only. Please find below the datacolumn code and the method along with the method call-
Column-
<telerikGrid:GridViewDataColumn x:Name="colResultID">
<telerikGrid:GridViewDataColumn.CellTemplate>
<DataTemplate>
<TextBlock x:Name="txtblkResultID" />
</DataTemplate>
</telerikGrid:GridViewDataColumn.CellTemplate>
<telerikGrid:GridViewDataColumn.CellEditTemplate>
<DataTemplate>
<TextBox x:Name="txtboxResultID" />
</DataTemplate>
</telerikGrid:GridViewDataColumn.CellEditTemplate>
</telerikGrid:GridViewDataColumn>
Method-
private void SetGridConfiguration(Admin_ConfigBDO admin_ConfigBDO,
GridViewDataColumn column, string bindingName)
{
try
{
if (lstMyDisplayColumns.Contains(admin_ConfigBDO.DisplayName))
{
column.Header = admin_ConfigBDO.DisplayName;
column.IsReadOnly = admin_ConfigBDO.IsRead_only;
column.IsFilterable = admin_ConfigBDO.IsFilterField;
column.IsGroupable = admin_ConfigBDO.CanGroup_By;
//column.DataType = admin_ConfigBDO.DataType;
column.DataMemberBinding =
new Binding(bindingName);
}
else
{
rdgMitigationEvents.Columns.Remove(column);
}
}
catch (Exception ex)
{
}
}
Method Call (inside a web service completed event-
void svcAdminSoapClient_GetMitigationConfigDetailsCompleted(object sender, GetMitigationConfigDetailsCompletedEventArgs e)
{
try
{
admin_MitignConfigBDO = e.Result;
SetGridConfiguration(admin_MitignConfigBDO.ResultID, colResultID,
"ResultID");
}
catch (Exception ex)
{
}
}
the parameter colResultID always comes out to be null. The rest of the parametrs and other stuff is specific to my application and the only issue i have is the one mentioned above.....Please suggest me how to resolve this if anyone has ever came acroos with such issue.
Thanks in Advance,
Abhishek Chauhan
