I am retrieving data from database using RadGrid. I have more columns in my RadGrid, so I need to show RadGrid horizontal scroll to keep the page from expanding but disable the vertical scroll so height of the grid should expand to always display all rows in the grid. I got the result but there is whitespace in the bottom of the RadGrid.
My UI of the RadGrid:
-------------------------------
<table style="table-layout: fixed;" width="100%" cellpadding="0" cellspacing="0"
border="0">
<tr>
<td>
<telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="false" PagerStyle-AlwaysVisible="true"
CellPadding="0" CellSpacing="0" GridLines="None" Skin="Metro" CssClass="RadGrid_CBGrid"
HorizontalAlign="Left" AutoGenerateColumns="False" OnItemCommand="RadGrid1_ItemCommand"
OnDataBound="RadGrid1_DataBound">
<ClientSettings>
<Selecting CellSelectionMode="SingleCell"></Selecting>
<Scrolling AllowScroll="true" UseStaticHeaders="True"></Scrolling>
</ClientSettings>
<MasterTableView HierarchyLoadMode="Client" DataKeyNames="EmpID" AllowMultiColumnSorting="true"
Name="Parent">
<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
<RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
</RowIndicatorColumn>
<ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
</ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn DataField="EmpID" EmptyDataText="NA" HeaderText="Emp ID"
UniqueName="EmpID">
</telerik:GridBoundColumn>
and so on......
-------------------
</Columns>
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column">
</EditColumn>
</EditFormSettings>
</MasterTableView>
<FilterMenu EnableImageSprites="False">
</FilterMenu>
</telerik:RadGrid>
</td>
</tr>
</table>
If I changed ClientSettings-Scrolling-AllowScroll="true" in RadGrid and <Scrolling AllowScroll="false" UseStaticHeaders="True"></Scrolling>
I got the result and there is NO whitespace in the bottom of the RadGrid BUT Horizontal scroll bar is NOT coming in my RadGrid.
So can anybody please give me the solution.
Thanks in Advance.
I am retrieving data from database using RadGrid. I have more columns in my RadGrid, so I need to show RadGrid horizontal scroll to keep the page from expanding but disable the vertical scroll so height of the grid should expand to always display all rows in the grid. I got the result but there is whitespace in the bottom of the RadGrid.
My UI of the RadGrid:
-------------------------------
<table style="table-layout: fixed;" width="100%" cellpadding="0" cellspacing="0"
border="0">
<tr>
<td>
<telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="false" PagerStyle-AlwaysVisible="true"
CellPadding="0" CellSpacing="0" GridLines="None" Skin="Metro" CssClass="RadGrid_CBGrid"
HorizontalAlign="Left" AutoGenerateColumns="False" OnItemCommand="RadGrid1_ItemCommand"
OnDataBound="RadGrid1_DataBound">
<ClientSettings>
<Selecting CellSelectionMode="SingleCell"></Selecting>
<Scrolling AllowScroll="true" UseStaticHeaders="True"></Scrolling>
</ClientSettings>
<MasterTableView HierarchyLoadMode="Client" DataKeyNames="EmpID" AllowMultiColumnSorting="true"
Name="Parent">
<CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
<RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
</RowIndicatorColumn>
<ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
</ExpandCollapseColumn>
<Columns>
<telerik:GridBoundColumn DataField="EmpID" EmptyDataText="NA" HeaderText="Emp ID"
UniqueName="EmpID">
</telerik:GridBoundColumn>
and so on......
-------------------
</Columns>
<EditFormSettings>
<EditColumn FilterControlAltText="Filter EditCommandColumn column">
</EditColumn>
</EditFormSettings>
</MasterTableView>
<FilterMenu EnableImageSprites="False">
</FilterMenu>
</telerik:RadGrid>
</td>
</tr>
</table>
If I changed ClientSettings-Scrolling-AllowScroll="true" in RadGrid and <Scrolling AllowScroll="false" UseStaticHeaders="True"></Scrolling>
I got the result and there is NO whitespace in the bottom of the RadGrid BUT Horizontal scroll bar is NOT coming in my RadGrid.
So can anybody please give me the solution.
Thanks in Advance.
<telerik:RadScriptManager runat="server" ID="radScriptManager1" />
<telerik:RadGrid runat="server"
ID="radGrid1"
AutoGenerateColumns="False"
EnableViewState="True"
OnItemCreated="radGrid1_OnItemCreated"
OnItemCommand="radGrid1_OnItemCommand"
OnNeedDataSource="lnkCopyGrade_OnNeedDataSource">
<MasterTableView AllowFilteringByColumn="False" CommandItemDisplay="None" ClientDataKeyNames="grade_id">
<SortExpressions>
<telerik:GridSortExpression FieldName="grade_name" SortOrder="Ascending"/>
</SortExpressions>
<SortExpressions>
<telerik:GridSortExpression FieldName="sort_order" SortOrder="Ascending"/>
</SortExpressions>
<Columns>
<telerik:GridTemplateColumn HeaderText="" AllowFiltering="False">
<ItemTemplate>
<asp:ImageButton runat="server" ID="lnkCopyGrade" AlternateText="Copy Grade"
CommandArgument='<%# DataBinder.Eval(Container.DataItem,"grade_id") %>'
CommandName="copyGrade" ImageUrl="../../../images/icons/CopyIconSmall24x24.png" ToolTip="Copy Grade"/>
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridBoundColumn HeaderText="Full Name" DataField="grade_name"
AllowSorting="True" AllowFiltering="False"/>
<telerik:GridBoundColumn HeaderText="Sort<br>Order" DataField="sort_order" ItemStyle-HorizontalAlign="Center" AllowSorting="True" AllowFiltering="False"/>
</Columns>
</MasterTableView>
</telerik:RadGrid>
<telerik:RadAjaxManager ID="ajaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="radGrid1" EventName="OnItemCommand">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="radGrid1" />
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
And here is the relevant codebehind
protected void radGrid1_OnItemCommand(object sender, GridCommandEventArgs e)
{
int iGradeID = RVConversion.ToInt32(e.CommandArgument);
string sGradeName = radGrid1.Items[e.Item.ItemIndex].Cells[(int) COLS.NAME].Text;
string sURL;
switch (e.CommandName)
{
case "copyGrade":
CopyGrade(iGradeID);
break;
}
}
private void CopyGrade(int gradeID)
{
//rv_copy_grade
var arrParams = new RVParamArrayList();
arrParams.addInt32Param("@gradeID", gradeID);
var result = RVDB.execCommand("rv_copy_grade", arrParams);
radGrid1.Rebind();
}
protected void lnkCopyGrade_OnNeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
object o = null;
IRVPageData_Base_GetData(ref o, new object[] { Entity.EntityID, null });
var ds = (GradeDataSet)o;
DataTable table = ds.Tables[0];
const string sAccessColumnName = "access";
table.Columns.Add(sAccessColumnName, Type.GetType("System.Int32"));
RVUserMisc.AddGradeSecurityToTable(table, sAccessColumnName, this);
var dv = new DataView(table);
radGrid1.DataSource = dv;
}
Worth saying that at the end of lnkCopyGrade_OnNeedDataSource database is getting updated but
from the console window of the browser I can see that following exception is thrown :
Uncaught Sys.WebForms.PageRequestManagerParserErrorException: Sys.WebForms.PageRequestManagerParserErrorException: The message received from the server could not be parsed. Common causes for this error are when the response is modified by calls to Response.Write(), response filters, HttpModules, or server trace is enabled.
Details: Error parsing near '<!DOCTYPE html PUBLI'. Telerik.Web.UI.WebResource.axd:6
Error.create Telerik.Web.UI.WebResource.axd:6
Sys.WebForms.PageRequestManager._createPageRequestManagerParserError Telerik.Web.UI.WebResource.axd:15
Sys.WebForms.PageRequestManager._parseDelta Telerik.Web.UI.WebResource.axd:15
Sys.WebForms.PageRequestManager._onFormSubmitCompleted Telerik.Web.UI.WebResource.axd:15
(anonymous function) Telerik.Web.UI.WebResource.axd:6
(anonymous function) Telerik.Web.UI.WebResource.axd:6
Sys.Net.WebRequest.completed Telerik.Web.UI.WebResource.axd:6
_onReadyStateChange Telerik.Web.UI.WebResource.axd:6
Thanks.