Hi,
1) I have a RadGrid with MasterTableView and DetailTables. There are many columns in DetailTables and because of this the last column will not be shown fully. I want the Horizontal scroll to appear so that we can see the last column properly. I have added the code <Scrolling AllowScroll="True" ScrollHeight="50px" UseStaticHeaders="true" /> but still the Horizontal scroll is not appearing. How to achieve this?
2) If I enter data in textbox (in RadGrid) and go to Page 2 and come back again to Page 1, the data entered in Page 1 will be lost. I want to retain the values in the grid after Paging. How to retain the data after pagination?
The browser I am using is IE8.
I have also attached the code and screenshot. Please provide the solution for the queries.
Thanks,
Nagendra
1) I have a RadGrid with MasterTableView and DetailTables. There are many columns in DetailTables and because of this the last column will not be shown fully. I want the Horizontal scroll to appear so that we can see the last column properly. I have added the code <Scrolling AllowScroll="True" ScrollHeight="50px" UseStaticHeaders="true" /> but still the Horizontal scroll is not appearing. How to achieve this?
2) If I enter data in textbox (in RadGrid) and go to Page 2 and come back again to Page 1, the data entered in Page 1 will be lost. I want to retain the values in the grid after Paging. How to retain the data after pagination?
The browser I am using is IE8.
I have also attached the code and screenshot. Please provide the solution for the queries.
<
telerik:RadGrid
ID
=
"rgCostBasisInquiry"
runat
=
"server"
AllowMultiRowSelection
=
"false"
AllowPaging
=
"true"
OnPreRender
=
"rgCostBasisInquiry_PreRender"
ShowHeader
=
"true"
AutoGenerateColumns
=
"False"
loadingtemplatetransparency
=
"25"
OnNeedDataSource
=
"rgCostBasisInquiry_NeedDataSource"
Width
=
"750px"
OnItemDataBound
=
"rgCostBasisInquiry_ItemDataBound"
OnDetailTableDataBind
=
"rgCostBasisInquiry_DetailTableDataBind"
GridLines
=
"None"
AllowSorting
=
"True"
Height
=
"220px"
AlternatingItemStyle-BackColor
=
"AliceBlue"
Skin
=
"Office2007"
>
<
AlternatingItemStyle
BackColor
=
"AliceBlue"
></
AlternatingItemStyle
>
<
MasterTableView
TableLayout
=
"Fixed"
Name
=
"CBInquiryGrid"
DataKeyNames
=
"SecurityMasterID"
EnableNoRecordsTemplate
=
"true"
>
<
PagerStyle
Mode
=
"NextPrevAndNumeric"
Visible
=
"true"
/>
<
NoRecordsTemplate
>
<
div
>No records to display</
div
>
</
NoRecordsTemplate
>
<
ParentTableRelation
>
<
telerik:GridRelationFields
DetailKeyField
=
"SecurityMasterID"
MasterKeyField
=
"SecurityMasterID"
/>
</
ParentTableRelation
>
<
DetailTables
>
<
telerik:GridTableView
AllowPaging
=
"false"
Name
=
"gtvCBInquiryChildGrid"
runat
=
"server"
ShowHeader
=
"true"
Width
=
"100%"
>
<
RowIndicatorColumn
>
<
HeaderStyle
Width
=
"5px"
></
HeaderStyle
>
</
RowIndicatorColumn
>
<
ExpandCollapseColumn
>
<
HeaderStyle
Width
=
"5px"
></
HeaderStyle
>
</
ExpandCollapseColumn
>
<
Columns
>
<
telerik:GridTemplateColumn
DataField
=
"SecurityMasterID"
HeaderButtonType
=
"TextButton"
HeaderText
=
"SecurityMasterID"
SortExpression
=
"SecurityMasterID"
UniqueName
=
"SecurityMasterID"
Visible
=
"false"
>
<
HeaderStyle
HorizontalAlign
=
"left"
Width
=
"0px"
/>
<
ItemStyle
HorizontalAlign
=
"left"
/>
<
ItemTemplate
>
<
asp:Label
runat
=
"server"
ID
=
"lblSecurityMasterID"
Text='<%# DataBinder.Eval(Container.DataItem, "SecurityMasterID")%>'></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
DataField
=
"ParentLotID"
HeaderButtonType
=
"TextButton"
HeaderText
=
"ParentLotID"
SortExpression
=
"ParentLotID"
UniqueName
=
"ParentLotID"
Visible
=
"false"
>
<
HeaderStyle
HorizontalAlign
=
"left"
/>
<
ItemStyle
HorizontalAlign
=
"left"
/>
<
ItemTemplate
>
<
asp:Label
runat
=
"server"
ID
=
"lblParentLotID"
Text='<%# Convert.ToInt64(DataBinder.Eval(Container.DataItem, "ParentLotID"))%>'></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
DataField
=
"TradeNumber"
HeaderButtonType
=
"TextButton"
HeaderText
=
"Trade #"
SortExpression
=
"TradeNumber"
UniqueName
=
"TradeNumber"
>
<
HeaderStyle
HorizontalAlign
=
"center"
Width
=
"30px"
/>
<
ItemStyle
HorizontalAlign
=
"left"
/>
<
ItemTemplate
>
<
asp:LinkButton
ID
=
"hlTradeNumber"
Font-Underline
=
"true"
ForeColor
=
"Blue"
ToolTip
=
"Click here to view Cost Basis Detail screen"
runat
=
"server"
Text='<%# ((DataBinder.Eval(Container.DataItem, "TradeNumber") == null) || (DataBinder.Eval(Container.DataItem, "TradeNumber") == "")) ? " " : DataBinder.Eval(Container.DataItem, "TradeNumber")%>'></
asp:LinkButton
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
DataField
=
"TaxLotID"
HeaderButtonType
=
"TextButton"
HeaderText
=
"Lot ID"
SortExpression
=
"TaxLotID"
UniqueName
=
"TaxLotID"
>
<
HeaderStyle
HorizontalAlign
=
"center"
Width
=
"30px"
/>
<
ItemStyle
HorizontalAlign
=
"left"
/>
<
ItemTemplate
>
<
asp:LinkButton
ID
=
"hlLotID"
Font-Underline
=
"true"
ForeColor
=
"Blue"
ToolTip
=
"Click here to view Cost Basis Detail screen"
runat
=
"server"
Text='<%#Convert.ToInt64(DataBinder.Eval(Container.DataItem, "TaxLotID")) %>'></
asp:LinkButton
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
DataField
=
"MatchedLotID"
HeaderButtonType
=
"TextButton"
HeaderText
=
"Matched Lot ID"
SortExpression
=
"MatchedLotID"
UniqueName
=
"MatchedLotID"
>
<
HeaderStyle
HorizontalAlign
=
"center"
Width
=
"44px"
/>
<
ItemStyle
HorizontalAlign
=
"left"
/>
<
ItemTemplate
>
<
asp:LinkButton
ID
=
"hlMatchedLotID"
Font-Underline
=
"true"
ForeColor
=
"Blue"
ToolTip
=
"Click here to view Cost Basis Detail screen"
runat
=
"server"
Text='<%#Convert.ToInt64(DataBinder.Eval(Container.DataItem, "MatchedLotID")) %>'></
asp:LinkButton
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridBoundColumn
DataField
=
"TradeDate"
HeaderButtonType
=
"TextButton"
HeaderText
=
"Trade Date"
SortExpression
=
"TradeDate"
UniqueName
=
"TradeDate"
>
<
HeaderStyle
HorizontalAlign
=
"center"
Width
=
"50px"
/>
<
ItemStyle
HorizontalAlign
=
"left"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridTemplateColumn
DataField
=
"TradeType"
HeaderButtonType
=
"TextButton"
HeaderText
=
"Trade Type"
SortExpression
=
"TradeType"
UniqueName
=
"TradeType"
>
<
HeaderStyle
HorizontalAlign
=
"center"
Width
=
"54px"
/>
<
ItemStyle
HorizontalAlign
=
"left"
/>
<
ItemTemplate
>
<
asp:Label
runat
=
"server"
ID
=
"lblTradeType"
Text='<%# DataBinder.Eval(Container.DataItem, "TradeType")%>'></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridBoundColumn
DataField
=
"Quantity"
HeaderButtonType
=
"TextButton"
HeaderText
=
"Qty"
SortExpression
=
"Quantity"
UniqueName
=
"Quantity"
>
<
HeaderStyle
HorizontalAlign
=
"center"
Width
=
"33px"
/>
<
ItemStyle
HorizontalAlign
=
"left"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Price"
HeaderButtonType
=
"TextButton"
HeaderText
=
"Price"
SortExpression
=
"Price"
UniqueName
=
"Price"
>
<
HeaderStyle
HorizontalAlign
=
"center"
Width
=
"33px"
/>
<
ItemStyle
HorizontalAlign
=
"left"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"MarketValue"
HeaderButtonType
=
"TextButton"
HeaderText
=
"Market Value"
SortExpression
=
"MarketValue"
UniqueName
=
"MarketValueChld"
>
<
HeaderStyle
HorizontalAlign
=
"center"
Width
=
"45px"
/>
<
ItemStyle
HorizontalAlign
=
"left"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridTemplateColumn
DataField
=
"CostBasis"
HeaderButtonType
=
"TextButton"
HeaderText
=
"Cost Basis"
SortExpression
=
""
UniqueName
=
"CostBasis"
>
<
HeaderStyle
HorizontalAlign
=
"center"
Width
=
"36px"
/>
<
ItemStyle
HorizontalAlign
=
"left"
/>
<
ItemTemplate
>
<
telerik:RadNumericTextBox
ID
=
"txtCostBasis"
Font-Size
=
"xx-small"
runat
=
"server"
Width
=
"95%"
Value='<%# Convert.ToDecimal(DataBinder.Eval(Container.DataItem, "CostBasis"))%>'>
</
telerik:RadNumericTextBox
>
<
asp:HiddenField
ID
=
"hdnCostBasisChldHdnChanged"
runat
=
"server"
Value
=
"0"
/>
<
asp:HiddenField
ID
=
"hdnCostBasisChldHdn"
runat
=
"server"
Value='<%# Convert.ToDecimal(DataBinder.Eval(Container.DataItem, "CostBasis"))%>' />
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridBoundColumn
DataField
=
"UnrealisedGainLoss"
HeaderButtonType
=
"TextButton"
HeaderText
=
"Unrealized Gain/Loss"
SortExpression
=
"UnrealisedGainLoss"
UniqueName
=
"UnrealisedGainLoss"
>
<
HeaderStyle
HorizontalAlign
=
"center"
Width
=
"51px"
/>
<
ItemStyle
HorizontalAlign
=
"left"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"RealisedGainLoss"
HeaderButtonType
=
"TextButton"
HeaderText
=
"Realized Gain/Loss"
SortExpression
=
"RealisedGainLoss"
UniqueName
=
"RealisedGainLoss"
>
<
HeaderStyle
HorizontalAlign
=
"center"
Width
=
"47px"
/>
<
ItemStyle
HorizontalAlign
=
"left"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"GainLossTerm"
HeaderButtonType
=
"TextButton"
HeaderText
=
"Term"
SortExpression
=
"GainLossTerm"
UniqueName
=
"GainLossTerm"
>
<
HeaderStyle
HorizontalAlign
=
"center"
Width
=
"25px"
/>
<
ItemStyle
HorizontalAlign
=
"left"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"ClosedDate"
HeaderButtonType
=
"TextButton"
HeaderText
=
"Closed Date"
SortExpression
=
"ClosedDate"
UniqueName
=
"ClosedDate"
>
<
HeaderStyle
HorizontalAlign
=
"center"
Width
=
"50px"
/>
<
ItemStyle
HorizontalAlign
=
"left"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Gifted/Inherited"
HeaderButtonType
=
"TextButton"
HeaderText
=
"Gifted"
SortExpression
=
"Gifted"
UniqueName
=
"Gifted"
>
<
HeaderStyle
HorizontalAlign
=
"center"
Width
=
"29px"
/>
<
ItemStyle
HorizontalAlign
=
"left"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridTemplateColumn
DataField
=
"Action"
HeaderButtonType
=
"TextButton"
HeaderText
=
"Action"
SortExpression
=
"Action"
UniqueName
=
"Action"
>
<
HeaderStyle
HorizontalAlign
=
"center"
/>
<
ItemStyle
HorizontalAlign
=
"left"
/>
<
ItemTemplate
>
<
asp:LinkButton
ID
=
"hlAction"
Font-Underline
=
"true"
ForeColor
=
"Blue"
ToolTip
=
"Click here to view Update Lot screen"
runat
=
"server"
Text='<%# DataBinder.Eval(Container.DataItem, "Action") %>'></
asp:LinkButton
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
</
Columns
>
</
telerik:GridTableView
>
</
DetailTables
>
<
RowIndicatorColumn
>
<
HeaderStyle
Width
=
"5px"
></
HeaderStyle
>
</
RowIndicatorColumn
>
<
ExpandCollapseColumn
Visible
=
"True"
>
<
HeaderStyle
Width
=
"5px"
></
HeaderStyle
>
</
ExpandCollapseColumn
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"SecurityMasterID"
HeaderButtonType
=
"TextButton"
Visible
=
"false"
HeaderText
=
"SecurityMasterID"
SortExpression
=
"SecurityMasterID"
UniqueName
=
"SecurityMasterID"
>
<
HeaderStyle
HorizontalAlign
=
"left"
Width
=
"0%"
/>
<
ItemStyle
HorizontalAlign
=
"left"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridTemplateColumn
DataField
=
"Symbol"
HeaderButtonType
=
"TextButton"
HeaderText
=
"Symbol"
SortExpression
=
"Symbol"
UniqueName
=
"Symbol"
>
<
HeaderStyle
HorizontalAlign
=
"center"
Width
=
"70px"
/>
<
ItemStyle
HorizontalAlign
=
"left"
/>
<
ItemTemplate
>
<
asp:Label
runat
=
"server"
ID
=
"lblSymbol"
Text='<%# DataBinder.Eval(Container.DataItem, "Symbol")%>'></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
DataField
=
"CUSIP"
HeaderButtonType
=
"TextButton"
HeaderText
=
"CUSIP"
SortExpression
=
"CUSIP"
UniqueName
=
"CUSIP"
>
<
HeaderStyle
HorizontalAlign
=
"center"
Width
=
"70px"
/>
<
ItemStyle
HorizontalAlign
=
"left"
/>
<
ItemTemplate
>
<
asp:Label
runat
=
"server"
ID
=
"lblCUSIP"
Text='<%# DataBinder.Eval(Container.DataItem, "CUSIP")%>'></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
DataField
=
"Description"
HeaderButtonType
=
"TextButton"
HeaderText
=
"Description"
SortExpression
=
"Description"
UniqueName
=
"Description"
>
<
HeaderStyle
HorizontalAlign
=
"center"
Width
=
"160px"
/>
<
ItemStyle
HorizontalAlign
=
"left"
/>
<
ItemTemplate
>
<
asp:Label
runat
=
"server"
ID
=
"lblDescription"
Text='<%# DataBinder.Eval(Container.DataItem, "Description")%>'></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
DataField
=
"SecurityType"
HeaderButtonType
=
"TextButton"
HeaderText
=
"Sec.Type"
SortExpression
=
"SecurityType"
UniqueName
=
"SecurityType"
>
<
HeaderStyle
HorizontalAlign
=
"center"
Width
=
"55px"
/>
<
ItemStyle
HorizontalAlign
=
"left"
/>
<
ItemTemplate
>
<
asp:Label
runat
=
"server"
ID
=
"lblSecurityType"
Text='<%# DataBinder.Eval(Container.DataItem, "SecurityType")%>'></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridBoundColumn
DataField
=
"Quantity"
HeaderButtonType
=
"TextButton"
HeaderText
=
"Qty"
SortExpression
=
"Quantity"
UniqueName
=
"Quantity"
>
<
HeaderStyle
HorizontalAlign
=
"center"
Width
=
"60px"
/>
<
ItemStyle
HorizontalAlign
=
"left"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"MarketValue"
HeaderButtonType
=
"TextButton"
HeaderText
=
"Market Value"
SortExpression
=
"MarketValue"
UniqueName
=
"MarketValueParent"
>
<
HeaderStyle
HorizontalAlign
=
"center"
Width
=
"60px"
/>
<
ItemStyle
HorizontalAlign
=
"left"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridTemplateColumn
DataField
=
"UnRealisedGainLoss"
HeaderButtonType
=
"TextButton"
HeaderText
=
"Unrealized Gain/Loss"
SortExpression
=
"UnRealisedGainLoss"
UniqueName
=
"UnRealisedGainLoss"
>
<
HeaderStyle
HorizontalAlign
=
"center"
Width
=
"65px"
/>
<
ItemStyle
HorizontalAlign
=
"left"
/>
<
ItemTemplate
>
<
asp:Label
runat
=
"server"
ID
=
"lblUnrealisedGainLoss"
Text='<%# DataBinder.Eval(Container.DataItem, "UnRealisedGainLoss") %>'></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
DataField
=
"RealisedGainLoss"
HeaderButtonType
=
"TextButton"
HeaderText
=
"Realized Gain/Loss"
SortExpression
=
"RealisedGainLoss"
UniqueName
=
"RealisedGainLoss"
>
<
HeaderStyle
HorizontalAlign
=
"center"
Width
=
"65px"
/>
<
ItemStyle
HorizontalAlign
=
"left"
/>
<
ItemTemplate
>
<
asp:Label
runat
=
"server"
ID
=
"lblRealisedGainLoss"
Text='<%# DataBinder.Eval(Container.DataItem, "RealisedGainLoss") %>'></
asp:Label
>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
<
telerik:GridTemplateColumn
DataField
=
"Action"
HeaderButtonType
=
"TextButton"
HeaderText
=
""
SortExpression
=
"Action"
UniqueName
=
"Action"
>
<
HeaderStyle
HorizontalAlign
=
"left"
/>
<
ItemStyle
HorizontalAlign
=
"left"
/>
<
ItemTemplate
>
<
asp:ImageButton
ID
=
"hlAddTaxLot"
ToolTip
=
"Click here to add Tax Lot"
ImageUrl
=
"~/Skins/Office2007/Grid/AddRecord.gif"
runat
=
"server"
/>
</
ItemTemplate
>
</
telerik:GridTemplateColumn
>
</
Columns
>
</
MasterTableView
>
<
ClientSettings
AllowExpandCollapse
=
"true"
>
<
Scrolling
AllowScroll
=
"True"
ScrollHeight
=
"50px"
UseStaticHeaders
=
"true"
/>
<
Selecting
AllowRowSelect
=
"false"
/>
</
ClientSettings
>
<
FilterMenu
NotSelectedImageUrl
=
"~/Skins/GridSkin/Ice/NotSelectedMenu.gif"
SelectedImageUrl
=
"~/Skins/GridSkin/Ice/SelectedMenu.gif"
>
<
CollapseAnimation
Type
=
"OutQuint"
Duration
=
"200"
></
CollapseAnimation
>
</
FilterMenu
>
</
telerik:RadGrid
>
</
td
>
Thanks,
Nagendra