I'm creating dynamic multi header radgrid and inside the rows used colspan as well. everything works fine until i do horizontal scroll. during the horizontal scroll the cells are collapsed and some cells are missing. everything went wrong if we do horizontal scroll. any solution to fix this issue?
2 Answers, 1 is accepted
0
Shinu
Top achievements
Rank 2
answered on 29 Aug 2014, 08:24 AM
Hi yogaraj,
I was not able to reproduce such an issue at my end. Please try the sample code snippet.
ASPX:
C#:
Thanks,
Shinu
I was not able to reproduce such an issue at my end. Please try the sample code snippet.
ASPX:
<
asp:PlaceHolder
ID
=
"PlaceHolder1"
runat
=
"server"
></
asp:PlaceHolder
>
C#:
RadGrid rgrdSample;
protected
void
Page_Init(
object
source, System.EventArgs e)
{
rgrdSample =
new
RadGrid();
rgrdSample.ID =
"RadGrid1"
;
rgrdSample.MasterTableView.DataKeyNames =
new
string
[] {
"OrderID"
};
rgrdSample.AllowPaging =
true
;
rgrdSample.AutoGenerateColumns =
false
;
rgrdSample.AllowSorting =
true
;
rgrdSample.MasterTableView.Height = Unit.Pixel(700);
rgrdSample.Width = Unit.Pixel(700);
rgrdSample.ClientSettings.Scrolling.AllowScroll =
true
;
rgrdSample.NeedDataSource +=
new
GridNeedDataSourceEventHandler(rgrdSample_NeedDataSource);
GridColumnGroup columnGroup =
new
GridColumnGroup();
columnGroup.Name =
"group1"
;
columnGroup.HeaderText =
"group1"
;
rgrdSample.MasterTableView.ColumnGroups.Add(columnGroup);
columnGroup =
new
GridColumnGroup();
columnGroup.Name =
"group2"
;
columnGroup.HeaderText =
"group2"
;
rgrdSample.MasterTableView.ColumnGroups.Add(columnGroup);
columnGroup =
new
GridColumnGroup();
columnGroup.Name =
"group3"
;
columnGroup.HeaderText =
"group3"
;
rgrdSample.MasterTableView.ColumnGroups.Add(columnGroup);
GridButtonColumn btn =
new
GridButtonColumn();
btn.Text =
"Edit"
;
btn.CommandName =
"Edit"
;
rgrdSample.MasterTableView.Columns.Add(btn);
GridBoundColumn boundColumn;
boundColumn =
new
GridBoundColumn();
boundColumn.DataField =
"OrderID"
;
boundColumn.HeaderText =
"OrderID"
;
boundColumn.HeaderStyle.Width = Unit.Pixel(300);
boundColumn.ColumnGroupName =
"group1"
;
rgrdSample.MasterTableView.Columns.Add(boundColumn);
boundColumn =
new
GridBoundColumn();
boundColumn.DataField =
"ShipCountry"
;
boundColumn.HeaderText =
"ShipCountry"
;
boundColumn.HeaderStyle.Width = Unit.Pixel(300);
boundColumn.ColumnGroupName =
"group1"
;
rgrdSample.MasterTableView.Columns.Add(boundColumn);
boundColumn =
new
GridBoundColumn();
boundColumn.DataField =
"ShipVia"
;
boundColumn.HeaderText =
"ShipVia"
;
boundColumn.HeaderStyle.Width = Unit.Pixel(300);
boundColumn.ColumnGroupName =
"group1"
;
rgrdSample.MasterTableView.Columns.Add(boundColumn);
boundColumn =
new
GridBoundColumn();
boundColumn.DataField =
"Freight"
;
boundColumn.HeaderText =
"Freight"
;
boundColumn.HeaderStyle.Width = Unit.Pixel(300);
boundColumn.ColumnGroupName =
"group1"
;
rgrdSample.MasterTableView.Columns.Add(boundColumn);
boundColumn =
new
GridBoundColumn();
boundColumn.DataField =
"CustomerID"
;
boundColumn.HeaderText =
"CustomerID"
;
boundColumn.HeaderStyle.Width = Unit.Pixel(300);
boundColumn.ColumnGroupName =
"group2"
;
rgrdSample.MasterTableView.Columns.Add(boundColumn);
boundColumn =
new
GridBoundColumn();
boundColumn.DataField =
"ShipCity"
;
boundColumn.HeaderText =
"ShipCity"
;
boundColumn.HeaderStyle.Width = Unit.Pixel(300);
boundColumn.ColumnGroupName =
"group2"
;
rgrdSample.MasterTableView.Columns.Add(boundColumn);
boundColumn =
new
GridBoundColumn();
boundColumn.DataField =
"EmployeeID"
;
boundColumn.HeaderText =
"EmployeeID"
;
boundColumn.HeaderStyle.Width = Unit.Pixel(300);
boundColumn.ColumnGroupName =
"group2"
;
rgrdSample.MasterTableView.Columns.Add(boundColumn);
boundColumn =
new
GridBoundColumn();
boundColumn.DataField =
"ShipCity"
;
boundColumn.HeaderText =
"ShipCity"
;
boundColumn.HeaderStyle.Width = Unit.Pixel(300);
boundColumn.ColumnGroupName =
"group2"
;
rgrdSample.MasterTableView.Columns.Add(boundColumn);
GridDateTimeColumn col =
new
GridDateTimeColumn();
col.PickerType = GridDateTimeColumnPickerType.TimePicker;
col.DataField =
"OrderDate"
;
col.HeaderText =
"OrderDate"
;
col.DataType =
typeof
(DateTime);
col.DataFormatString =
"{0:HH:mm}"
;
col.HeaderStyle.Width = Unit.Pixel(300);
col.ColumnGroupName =
"group2"
;
rgrdSample.MasterTableView.Columns.Add(col);
boundColumn =
new
GridBoundColumn();
boundColumn.DataField =
"ShipRegion"
;
boundColumn.HeaderText =
"ShipRegion"
;
boundColumn.HeaderStyle.Width = Unit.Pixel(300);
boundColumn.ColumnGroupName =
"group3"
;
rgrdSample.MasterTableView.Columns.Add(boundColumn);
boundColumn =
new
GridBoundColumn();
boundColumn.DataField =
"ShippedDate"
;
boundColumn.HeaderText =
"ShippedDate"
;
boundColumn.HeaderStyle.Width = Unit.Pixel(300);
boundColumn.ColumnGroupName =
"group3"
;
rgrdSample.MasterTableView.Columns.Add(boundColumn);
boundColumn =
new
GridBoundColumn();
boundColumn.DataField =
"RequiredDate"
;
boundColumn.HeaderText =
"RequiredDate"
;
boundColumn.HeaderStyle.Width = Unit.Pixel(300);
boundColumn.ColumnGroupName =
"group3"
;
rgrdSample.MasterTableView.Columns.Add(boundColumn);
boundColumn =
new
GridBoundColumn();
boundColumn.DataField =
"ShipPostalCode"
;
boundColumn.HeaderText =
"ShipPostalCode"
;
boundColumn.HeaderStyle.Width = Unit.Pixel(300);
boundColumn.ColumnGroupName =
"group3"
;
rgrdSample.MasterTableView.Columns.Add(boundColumn);
this
.PlaceHolder1.Controls.Add(rgrdSample);
}
void
rgrdSample_NeedDataSource(
object
sender, GridNeedDataSourceEventArgs e)
{
rgrdSample.DataSource = GetDataTable(
"SELECT * FROM Orders"
);
}
public
DataTable GetDataTable(
string
query)
{
String ConnString = ConfigurationManager.ConnectionStrings[
"ConnectionString"
].ConnectionString;
SqlConnection conn =
new
SqlConnection(ConnString);
SqlDataAdapter adapter =
new
SqlDataAdapter();
adapter.SelectCommand =
new
SqlCommand(query, conn);
DataTable myDataTable =
new
DataTable();
conn.Open();
try
{
adapter.Fill(myDataTable);
}
finally
{
conn.Close();
}
return
myDataTable;
}
Thanks,
Shinu
0
yogaraj
Top achievements
Rank 1
answered on 29 Aug 2014, 08:41 AM
Hi Shinu, Thanks for the reply. I'm using same way of coding only. I suspect this issue is beacuse of i'm doing data row cell hiding (set cell visible false) to acheive the colspan between the cells. Refer the attachment, right side header row and data row columns are collapesed afer the horizontal scroll. any solution?