Hi,
I have several RadGrid in my application with lots of data in it.
I wanted to know why the scrolling go back to the top of the grid after a postback from edit or cancel edit.
Example:
I click on a row to edit it. At this point, the scrolling is ok. But when I click on Update or Cancel, the scroll go back to the top of the grid after the postback. Is it possible to keep the scroll or set the scroll to the top of the page and instead of the grid?
Thanks,
Jocelyn
I have several RadGrid in my application with lots of data in it.
I wanted to know why the scrolling go back to the top of the grid after a postback from edit or cancel edit.
Example:
I click on a row to edit it. At this point, the scrolling is ok. But when I click on Update or Cancel, the scroll go back to the top of the grid after the postback. Is it possible to keep the scroll or set the scroll to the top of the page and instead of the grid?
Thanks,
Jocelyn
6 Answers, 1 is accepted
0
Princy
Top achievements
Rank 2
answered on 18 Sep 2013, 12:48 PM
Hi Jocelyn,
For this scenario I would suggest you to use RadAjaxManager.By default, RadAjaxManager preserve the page scroll position.
ASPX:
Hope this helps,Let me know if any concern.
Thanks,
Princy
For this scenario I would suggest you to use RadAjaxManager.By default, RadAjaxManager preserve the page scroll position.
ASPX:
<
telerik:RadAjaxManager
ID
=
"RadAjaxMaanger1"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadGrid1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadGrid1"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
Hope this helps,Let me know if any concern.
Thanks,
Princy
0
Jocelyn
Top achievements
Rank 1
answered on 18 Sep 2013, 12:52 PM
Hi Princy,
I already use a RadAjaxManager and I have this issue.
Do you know what can cause this?
Here is my RadGrid:
Thanks,
Jocelyn
I already use a RadAjaxManager and I have this issue.
Do you know what can cause this?
Here is my RadGrid:
<
asp:Content
ID
=
"mainContent"
ContentPlaceHolderID
=
"phMain"
runat
=
"server"
>
<
telerik:RadAjaxManagerProxy
runat
=
"server"
ID
=
"ramp1"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"gridFrequences"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"gridFrequences"
LoadingPanelID
=
"ralpMainSticky"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManagerProxy
>
<
asp:Panel
runat
=
"server"
ID
=
"panelMain"
CssClass
=
"fsCGSI no-padding"
>
<
div
id
=
"divEntete"
class
=
"fsTitle"
>
<
span
id
=
"lblEntete"
runat
=
"server"
>
<%=GetMessageEx(6634).Texte%></
span
>
</
div
>
<
div
class
=
"fsContent"
>
<
telerik:RadGrid
ID
=
"gridFrequences"
runat
=
"server"
CellSpacing
=
"0"
GridLines
=
"None"
>
<
MasterTableView
CommandItemDisplay
=
"Top"
>
<
CommandItemTemplate
>
<
table
border
=
"0"
style
=
"width: 100%; padding-right: 7px;"
cellpadding
=
"0"
cellspacing
=
"0"
>
<
tr
>
<
td
style
=
"width: 50%;"
>
<
telerik:RadToolBar
ID
=
"mainToolBar"
Width
=
"100%"
runat
=
"server"
EnableRoundedCorners
=
"False"
EnableShadows
=
"True"
BorderWidth
=
"0"
AutoPostBack
=
"true"
BackColor
=
"Transparent"
>
<
Items
>
<
telerik:RadToolBarButton
ImageUrl
=
"Images/Icons/Interface-69_16x16.png"
ToolTip='<%# GetMessageEx(3177).Texte %>'
AccessKey="A" Text='<%# GetMessageEx(3177).Texte %>' Value="Ajouter" CommandName="InitInsert" />
<
telerik:RadToolBarButton
IsSeparator
=
"true"
/>
<
telerik:RadToolBarButton
Value
=
"ShowAll"
>
<
ItemTemplate
>
<
telerik:RadButton
runat
=
"server"
ID
=
"rtbShowAllItems"
Text='<%# GetMessageEx(7049).Texte %>'
CommandName="ShowAll" ButtonType="ToggleButton" ToggleType="CheckBox">
</
telerik:RadButton
>
</
ItemTemplate
>
</
telerik:RadToolBarButton
>
</
Items
>
</
telerik:RadToolBar
>
</
td
>
<
td
style
=
"width: 50%; text-align: right"
>
<
div
style
=
"float: right; margin-left: 8px;"
>
<
asp:Button
ID
=
"btnRefresh"
CommandName
=
"Rebind"
runat
=
"server"
CssClass
=
"rgRefresh"
>
</
asp:Button
>
<
asp:LinkButton
ID
=
"lnkRefresh"
Text='<%# GetMessageEx(6653).Texte %>' CommandName="Rebind"
runat="server">
</
asp:LinkButton
>
</
div
>
</
td
>
</
tr
>
</
table
>
</
CommandItemTemplate
>
<
CommandItemSettings
ExportToPdfText
=
"Export to PDF"
></
CommandItemSettings
>
<
RowIndicatorColumn
Visible
=
"True"
FilterControlAltText
=
"Filter RowIndicator column"
>
</
RowIndicatorColumn
>
<
ExpandCollapseColumn
Visible
=
"True"
FilterControlAltText
=
"Filter ExpandColumn column"
>
</
ExpandCollapseColumn
>
<
Columns
>
<
telerik:GridEditCommandColumn
FilterControlAltText
=
"Filter EditCommandColumn column"
ButtonType
=
"ImageButton"
EditText
=
"Modifier"
Resizable
=
"False"
HeaderStyle-Width
=
"46px"
EditImageUrl
=
"Images/Icons/006-Write-New-Icon.png"
>
<
HeaderStyle
Width
=
"32px"
></
HeaderStyle
>
</
telerik:GridEditCommandColumn
>
<
telerik:GridButtonColumn
CommandName
=
"Delete"
FilterControlAltText
=
"Filter column column"
ConfirmDialogWidth
=
"300px"
ConfirmDialogHeight
=
"120px"
Text
=
"Supprimer"
UniqueName
=
"colDelete"
ButtonType
=
"ImageButton"
ImageUrl
=
"Images/Icons/059-Close-Delete-circle-Icon.png"
Resizable
=
"False"
HeaderStyle-Width
=
"46px"
ConfirmDialogType
=
"RadWindow"
ConfirmTitle
=
"GESPHARxLite"
>
<
HeaderStyle
Width
=
"32px"
></
HeaderStyle
>
</
telerik:GridButtonColumn
>
<
telerik:GridBoundColumn
AutoPostBackOnFilter
=
"true"
DataField
=
"PPSO_NOAUTO"
UniqueName
=
"colNoAuto"
Visible
=
"False"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
AutoPostBackOnFilter
=
"true"
DataField
=
"PPSO_CODE"
HeaderText
=
"Code"
UniqueName
=
"colCode"
ShowFilterIcon
=
"False"
CurrentFilterFunction
=
"StartsWith"
FilterControlWidth
=
"90px"
>
<
ItemStyle
Width
=
"100px"
/>
<
HeaderStyle
Width
=
"100px"
/>
<
FooterStyle
Width
=
"100px"
/>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
AutoPostBackOnFilter
=
"true"
DataField
=
"PPSO_DESCRIPTION"
HeaderText
=
"Description"
UniqueName
=
"colDescription"
ShowFilterIcon
=
"False"
CurrentFilterFunction
=
"StartsWith"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
AutoPostBackOnFilter
=
"true"
DataField
=
"PPSO_ACTIF"
UniqueName
=
"colActif"
Visible
=
"false"
>
</
telerik:GridBoundColumn
>
</
Columns
>
<
EditFormSettings
EditFormType
=
"Template"
>
<
EditColumn
UniqueName
=
"EditCommandColumn1"
FilterControlAltText
=
"Filter EditCommandColumn1 column"
>
</
EditColumn
>
<
FormTemplate
>
<
div
class
=
"editLine"
>
<
span
style
=
"color: Red"
>
<%=MessageErreur%>
</
span
>
<
asp:HiddenField
runat
=
"server"
ID
=
"edNoAuto"
Value='<%# Bind("PPSO_NOAUTO") %>' />
<
div
class
=
"labelDiv"
>
<%=GetMessageEx(389).Texte%>
</
div
>
<
telerik:RadTextBox
ID
=
"edCode"
runat
=
"server"
Text='<%# Bind("PPSO_CODE") %>' DataType="System.String"
Width="77" autocomplete="off" MinValue="0" MaxLength="12" Enabled='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "true", "false") %>'
SelectionOnFocus="SelectAll">
</
telerik:RadTextBox
>
<
asp:RequiredFieldValidator
ID
=
"RequiredFieldValidator2"
ControlToValidate
=
"edCode"
ErrorMessage='<%# GetMessageEx(1744).Texte%>' runat="server" Display="Dynamic"
ValidationGroup="gridValid" />
<
div
class
=
"spacer"
>
</
div
>
</
div
>
<
div
class
=
"editLine"
>
<
div
class
=
"labelDiv"
>
<%=GetMessageEx(205).Texte%>
</
div
>
<
telerik:RadTextBox
ID
=
"edDescription"
runat
=
"server"
Text='<%# Bind("PPSO_DESCRIPTION") %>'
DataType="System.String" Width="277" autocomplete="off" MinValue="0" MaxLength="50"
SelectionOnFocus="SelectAll">
</
telerik:RadTextBox
>
<
asp:RequiredFieldValidator
ID
=
"RequiredFieldValidator1"
ControlToValidate
=
"edDescription"
ErrorMessage='<%# GetMessageEx(1744).Texte%>' runat="server" Display="Dynamic"
ValidationGroup="gridValid" />
<
div
class
=
"spacer"
>
</
div
>
</
div
>
<
div
style
=
"margin: 5px 0"
>
<
telerik:RadButton
runat
=
"server"
ID
=
"chkOneTime"
Text='<%# GetMessageEx(6676).Texte %>'
AutoPostBack="false" OnClientCheckedChanged="Frequence.chkOneTime_CheckedChanged"
ButtonType="ToggleButton" ToggleType="CheckBox">
</
telerik:RadButton
>
</
div
>
<
div
>
<
div
class
=
"fsCGSI"
id
=
"fsHeures"
runat
=
"server"
>
<
div
class
=
"fsLegend"
>
<%=GetMessageEx(4040).Texte%></
div
>
<%--Heures--%>
<
ul
style
=
"list-style-type: none; padding-left: 0; margin: 0"
>
<
li
style
=
"padding-bottom: 5px"
>
<
asp:RadioButton
ID
=
"rbAucuneHeure"
runat
=
"server"
GroupName
=
"gpHeures"
Text="<%#GetMessageEx(6643).Texte%>"
Width="300px"></
asp:RadioButton
>
</
li
>
<
li
style
=
"padding-bottom: 5px"
>
<
asp:RadioButton
ID
=
"rbHeuresFixes"
runat
=
"server"
GroupName
=
"gpHeures"
Text="<%#GetMessageEx(6636).Texte%>"
Width="147px"></
asp:RadioButton
>
<
telerik:RadNumericTextBox
runat
=
"server"
NumberFormat-DecimalDigits
=
"0"
ID
=
"edHeuresFixes"
MaxLength
=
"2"
MinValue
=
"0"
MaxValue
=
"99"
DecimalDigits
=
"0"
Width
=
"30px"
Text='<%# Bind("PPSO_MULTIPLIC") %>'
SelectionOnFocus="SelectAll">
<
ClientEvents
OnKeyPress
=
"Frequence.KeyPressNumeric"
/>
<
NumberFormat
DecimalDigits
=
"0"
ZeroPattern
=
"n"
></
NumberFormat
>
</
telerik:RadNumericTextBox
>
<
label
id
=
"lblHeureFixe"
runat
=
"server"
>
<%=GetMessageEx(6637).Texte%></
label
>
<
asp:RequiredFieldValidator
ID
=
"rfvHeuresFixes"
ControlToValidate
=
"edHeuresFixes"
ErrorMessage='<%# GetMessageEx(1744).Texte%>' runat="server" Display="Dynamic"
ValidationGroup="gridValid" />
</
li
>
<
li
>
<
asp:RadioButton
Text="<%#GetMessageEx(6638).Texte%>" runat="server" GroupName="gpHeures"
ID="rbHeuresVar" Width="147px"></
asp:RadioButton
>
<
label
id
=
"lblHeuresVar1"
runat
=
"server"
>
<%=GetMessageEx(3698).Texte%></
label
>
<
telerik:RadNumericTextBox
runat
=
"server"
ID
=
"edHeuresVar"
MaxLength
=
"2"
MinValue
=
"0"
MaxValue
=
"99"
DecimalDigits
=
"0"
Width
=
"30px"
Text='<%# Bind("PPSO_H_FIXE") %>'
SelectionOnFocus="SelectAll">
<
ClientEvents
OnKeyPress
=
"Frequence.KeyPressNumeric"
/>
<
NumberFormat
DecimalDigits
=
"0"
ZeroPattern
=
"n"
></
NumberFormat
>
</
telerik:RadNumericTextBox
>
<
label
id
=
"lblHeuresVar2"
runat
=
"server"
>
<%=GetMessageEx(1967).Texte%></
label
>
<
asp:RequiredFieldValidator
ID
=
"rfvHeuresVar"
ControlToValidate
=
"edHeuresVar"
ErrorMessage='<%# GetMessageEx(1744).Texte%>'
runat="server" Display="Dynamic" ValidationGroup="gridValid" />
</
li
>
</
ul
>
</
div
>
</
div
>
<
div
>
<
div
class
=
"fsCGSI"
id
=
"fsJours"
runat
=
"server"
>
<
div
class
=
"fsLegend"
>
<%= GetMessageEx(5942).Texte%>
</
div
>
<%--Jours--%>
<
ul
style
=
"list-style-type: none; padding-left: 0; margin: 0"
>
<
li
style
=
"padding-bottom: 5px"
>
<
asp:RadioButton
ID
=
"rbTouslesJours"
runat
=
"server"
GroupName
=
"gpJours"
Text="<%#GetMessageEx(2814).Texte%>"
Width="147px"></
asp:RadioButton
>
</
li
>
<
li
style
=
"padding-bottom: 5px"
>
<
asp:RadioButton
Text="<%#GetMessageEx(6639).Texte%>" runat="server" GroupName="gpJours"
ID="rbXJours" Width="147px"></
asp:RadioButton
>
<
telerik:RadNumericTextBox
runat
=
"server"
ID
=
"edXJours"
MaxLength
=
"2"
MinValue
=
"2"
MaxValue
=
"99"
DecimalDigits
=
"0"
Width
=
"30px"
Text='<%# Bind("PPSO_I_NBRJ") %>'
SelectionOnFocus="SelectAll">
<
ClientEvents
OnKeyPress
=
"Frequence.KeyPressNumeric"
/>
<
NumberFormat
DecimalDigits
=
"0"
ZeroPattern
=
"n"
></
NumberFormat
>
</
telerik:RadNumericTextBox
>
<
label
id
=
"Label3"
runat
=
"server"
>
<%=GetMessageEx(1740).Texte%></
label
>
<
asp:RequiredFieldValidator
ID
=
"rfvXJours"
ControlToValidate
=
"edXJours"
ErrorMessage='<%# GetMessageEx(1744).Texte%>'
runat="server" Display="Dynamic" ValidationGroup="gridValid" />
</
li
>
<
li
style
=
"padding-bottom: 5px"
>
<
asp:RadioButton
Text="<%#GetMessageEx(6641).Texte%>" runat="server" GroupName="gpJours"
ID="rbIntervalleJours" Width="147px"></
asp:RadioButton
>
<
telerik:RadNumericTextBox
runat
=
"server"
ID
=
"edIntervalleJoursX"
MaxLength
=
"2"
MinValue
=
"1"
MaxValue
=
"99"
DecimalDigits
=
"0"
Width
=
"30px"
Text='<%# Bind("PPSO_I_X_J") %>'
SelectionOnFocus="SelectAll">
<
ClientEvents
OnKeyPress
=
"Frequence.KeyPressNumeric"
/>
<
NumberFormat
DecimalDigits
=
"0"
ZeroPattern
=
"n"
></
NumberFormat
>
</
telerik:RadNumericTextBox
>
<
label
id
=
"Label1"
runat
=
"server"
>
<%=GetMessageEx(1966).Texte%></
label
>
<
telerik:RadNumericTextBox
runat
=
"server"
ID
=
"edIntervalleJoursY"
MaxLength
=
"2"
MinValue
=
"1"
MaxValue
=
"99"
DecimalDigits
=
"0"
Width
=
"30px"
Text='<%# Bind("PPSO_I_Y_J") %>'
SelectionOnFocus="SelectAll">
<
ClientEvents
OnKeyPress
=
"Frequence.KeyPressNumeric"
/>
<
NumberFormat
DecimalDigits
=
"0"
ZeroPattern
=
"n"
></
NumberFormat
>
</
telerik:RadNumericTextBox
>
<
asp:RequiredFieldValidator
ID
=
"rfvIntervalleJours"
ControlToValidate
=
"edIntervalleJoursY"
ErrorMessage='<%# GetMessageEx(1744).Texte%>' runat="server" Display="Dynamic"
ValidationGroup="gridValid" />
</
li
>
<
li
>
<
asp:RadioButton
Text="<%#GetMessageEx(6640).Texte%>" runat="server" GroupName="gpJours"
ID="rbJoursSemaine" Width="147px"></
asp:RadioButton
>
<
span
id
=
"spJoursDeSemaine"
style
=
"float: right; width: 318px"
>
<
asp:CheckBox
runat
=
"server"
ID
=
"chkDimanche"
Width
=
"77px"
Text="<%#GetMessageEx(225).Texte%>"
Checked='<%# Bind("PPSO_DIMANCHE") %>' />
<
asp:CheckBox
runat
=
"server"
ID
=
"chkLundi"
Width
=
"77px"
Text="<%#GetMessageEx(226).Texte%>"
Checked='<%# Bind("PPSO_LUNDI") %>' />
<
asp:CheckBox
runat
=
"server"
ID
=
"chkMardi"
Width
=
"77px"
Text="<%#GetMessageEx(227).Texte%>"
Checked='<%# Bind("PPSO_MARDI") %>' />
<
asp:CheckBox
runat
=
"server"
ID
=
"chkMercredi"
Width
=
"77px"
Text="<%#GetMessageEx(228).Texte%>"
Checked='<%# Bind("PPSO_MERCREDI") %>' />
<
asp:CheckBox
runat
=
"server"
ID
=
"chkJeudi"
Width
=
"77px"
Text="<%#GetMessageEx(229).Texte%>"
Checked='<%# Bind("PPSO_JEUDI") %>' />
<
asp:CheckBox
runat
=
"server"
ID
=
"chkVendredi"
Width
=
"77px"
Text="<%#GetMessageEx(230).Texte%>"
Checked='<%# Bind("PPSO_VENDREDI") %>' />
<
asp:CheckBox
runat
=
"server"
ID
=
"chkSamedi"
Width
=
"77px"
Text="<%#GetMessageEx(231).Texte%>"
Checked='<%# Bind("PPSO_SAMEDI") %>' />
</
span
>
<
div
class
=
"spacer"
>
</
div
>
</
li
>
</
ul
>
</
div
>
</
div
>
<
div
>
<
div
class
=
"fsCGSI"
id
=
"fsMois"
runat
=
"server"
>
<
div
class
=
"fsLegend"
>
<%= GetMessageEx(6635).Texte%>
</
div
>
<%--mois--%>
<
ul
style
=
"list-style-type: none; padding-left: 0; margin: 0"
>
<
li
style
=
"padding-bottom: 5px"
>
<
asp:RadioButton
ID
=
"rbTousLesMois"
runat
=
"server"
GroupName
=
"gpMois"
Text="<%#GetMessageEx(6642).Texte%>"
Width="147px"></
asp:RadioButton
>
</
li
>
<
li
>
<
asp:RadioButton
Text="<%#GetMessageEx(6641).Texte%>" runat="server" GroupName="gpMois"
ID="rbIntervalleMois" Width="147px"></
asp:RadioButton
>
<
telerik:RadNumericTextBox
runat
=
"server"
ID
=
"edIntervalleMoisX"
MaxLength
=
"2"
MinValue
=
"1"
MaxValue
=
"99"
DecimalDigits
=
"0"
Width
=
"30px"
Text='<%# Bind("PPSO_I_X_MS") %>'
SelectionOnFocus="SelectAll">
<
ClientEvents
OnKeyPress
=
"Frequence.KeyPressNumeric"
/>
<
NumberFormat
DecimalDigits
=
"0"
ZeroPattern
=
"n"
></
NumberFormat
>
</
telerik:RadNumericTextBox
>
<
label
id
=
"Label2"
runat
=
"server"
>
<%=GetMessageEx(1965).Texte%></
label
>
<
telerik:RadNumericTextBox
runat
=
"server"
ID
=
"edIntervalleMoisY"
MaxLength
=
"2"
MinValue
=
"1"
MaxValue
=
"99"
DecimalDigits
=
"0"
Width
=
"30px"
Text='<%# Bind("PPSO_I_Y_MS") %>'
SelectionOnFocus="SelectAll">
<
ClientEvents
OnKeyPress
=
"Frequence.KeyPressNumeric"
/>
<
NumberFormat
DecimalDigits
=
"0"
ZeroPattern
=
"n"
></
NumberFormat
>
</
telerik:RadNumericTextBox
>
<
asp:RequiredFieldValidator
ID
=
"rfvIntervalleMois"
ControlToValidate
=
"edIntervalleMoisY"
ErrorMessage='<%# GetMessageEx(1744).Texte%>' runat="server" Display="Dynamic"
ValidationGroup="gridValid" />
</
li
>
</
div
>
</
div
>
<
asp:Button
ID
=
"btnUpdate"
Text='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), GetMessageEx(3177).Texte, GetMessageEx(4479).Texte) %>'
runat="server" CommandName='<%# IIf((TypeOf(Container) is GridEditFormInsertItem), "PerformInsert", "Update") %>'
ValidationGroup="gridValid"></
asp:Button
>
<
asp:Button
ID
=
"btnCancel"
Text='<%# GetMessageEx(1043).Texte%>' runat="server" CommandName="Cancel">
</
asp:Button
>
</
FormTemplate
>
</
EditFormSettings
>
</
MasterTableView
>
<
FilterMenu
EnableImageSprites
=
"False"
>
</
FilterMenu
>
<
EditItemStyle
BackColor
=
"Silver"
/>
</
telerik:RadGrid
>
</
div
>
</
asp:Panel
>
</
asp:Content
>
Thanks,
Jocelyn
0
Princy
Top achievements
Rank 2
answered on 19 Sep 2013, 11:47 AM
Hi Jocelyn,
Please try adding the following code to your page directive MaintainScrollPositionOnPostback="true".
ASPX:
Thanks,
Princy
Please try adding the following code to your page directive MaintainScrollPositionOnPostback="true".
ASPX:
<%@ Page Language="C#" AutoEventWireup="true" MaintainScrollPositionOnPostback="true" . . . %>
Thanks,
Princy
0
Jocelyn
Top achievements
Rank 1
answered on 02 Oct 2013, 06:11 PM
Hi Princy,
I already tried this solution buit this is not working. I attached an image to illustrate the issue. it only happens with RadGrids.
The image illustrate when I click on a row to edit it.
Thanks.
I already tried this solution buit this is not working. I attached an image to illustrate the issue. it only happens with RadGrids.
The image illustrate when I click on a row to edit it.
Thanks.
0
Princy
Top achievements
Rank 2
answered on 03 Oct 2013, 07:40 AM
Hi Jocelyn,
I have tried your code and it works fine at my end ,here is a sample code snippet that I tried which works fine.Please have a look.
ASPX(MasterPage):
ASPX:
Thanks,
Princy
I have tried your code and it works fine at my end ,here is a sample code snippet that I tried which works fine.Please have a look.
ASPX(MasterPage):
<
asp:ContentPlaceHolder
ID
=
"ContentPlaceHolder1"
runat
=
"server"
>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
</
telerik:RadAjaxManager
>
</
asp:ContentPlaceHolder
>
ASPX:
<%@ Page Title="" Language="C#" MasterPageFile="~/RadWindow/MasterPage.master" AutoEventWireup="true"
MaintainScrollPositionOnPostback="true" CodeFile="EditForm.aspx.cs" Inherits="RadWindow_EditForm" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<
asp:Content
ID
=
"Content1"
ContentPlaceHolderID
=
"head"
runat
=
"Server"
>
</
asp:Content
>
<
asp:Content
ID
=
"Content2"
ContentPlaceHolderID
=
"ContentPlaceHolder1"
runat
=
"Server"
>
<
asp:ScriptManager
ID
=
"ScriptManager1"
runat
=
"server"
>
</
asp:ScriptManager
>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadGrid1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadGrid1"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
>
</
telerik:AjaxUpdatedControl
>
<
telerik:AjaxUpdatedControl
ControlID
=
"divMsgs"
></
telerik:AjaxUpdatedControl
>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
telerik:RadAjaxLoadingPanel
ID
=
"RadAjaxLoadingPanel1"
runat
=
"server"
>
</
telerik:RadAjaxLoadingPanel
>
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
CssClass
=
"RadGrid"
GridLines
=
"None"
AllowPaging
=
"false"
AllowSorting
=
"True"
AutoGenerateColumns
=
"False"
ShowStatusBar
=
"true"
AllowAutomaticDeletes
=
"True"
AllowAutomaticInserts
=
"True"
AllowAutomaticUpdates
=
"True"
DataSourceID
=
"SqlDataSource1"
>
<
MasterTableView
CommandItemDisplay
=
"TopAndBottom"
DataSourceID
=
"SqlDataSource1"
DataKeyNames
=
"OrderID"
>
<
Columns
>
<
telerik:GridEditCommandColumn
>
</
telerik:GridEditCommandColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"OrderID"
HeaderText
=
"OrderID"
DataField
=
"OrderID"
>
<
HeaderStyle
ForeColor
=
"Silver"
Width
=
"20px"
></
HeaderStyle
>
<
ItemStyle
ForeColor
=
"Gray"
></
ItemStyle
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"ShipCity"
HeaderText
=
"ShipCity"
DataField
=
"ShipCity"
>
<
HeaderStyle
Width
=
"60px"
></
HeaderStyle
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
UniqueName
=
"ShipName"
HeaderText
=
"ShipName"
DataField
=
"ShipName"
>
</
telerik:GridBoundColumn
>
<
telerik:GridButtonColumn
CommandName
=
"Delete"
Text
=
"Delete"
UniqueName
=
"column"
>
</
telerik:GridButtonColumn
>
</
Columns
>
<
EditFormSettings
EditFormType
=
"Template"
>
<
FormTemplate
>
<
table
id
=
"Table2"
cellspacing
=
"2"
cellpadding
=
"1"
width
=
"100%"
border
=
"0"
rules
=
"none"
style
=
"border-collapse: collapse;"
>
<
tr
class
=
"EditFormHeader"
>
<
td
colspan
=
"2"
style
=
"font-size: small"
>
<
b
>Details</
b
>
</
td
>
</
tr
>
<
tr
>
<
td
colspan
=
"2"
>
<
b
>Order Info:</
b
>
</
td
>
</
tr
>
<
tr
>
<
td
>
<
table
id
=
"Table3"
cellspacing
=
"1"
cellpadding
=
"1"
width
=
"250"
border
=
"0"
class
=
"module"
>
<
tr
>
<
td
>
</
td
>
<
td
>
</
td
>
</
tr
>
<
tr
>
<
td
>
ShipCity:
</
td
>
<
td
>
<
asp:TextBox
ID
=
"TextBox7"
runat
=
"server"
Text='<%# Bind("ShipCity") %>'>
</
asp:TextBox
>
</
td
>
</
tr
>
<
tr
>
<
td
>
ShipName:
</
td
>
<
td
>
<
asp:TextBox
ID
=
"TextBox8"
runat
=
"server"
Text='<%# Bind("ShipName") %>' TabIndex="1">
</
asp:TextBox
>
</
td
>
</
tr
>
</
table
>
</
td
>
</
tr
>
<
tr
>
<
td
align
=
"right"
colspan
=
"2"
>
<
asp:Button
ID
=
"btnUpdate"
Text='<%# (Container is GridEditFormInsertItem) ? "Insert" : "Update" %>'
runat="server" CommandName='<%# (Container is GridEditFormInsertItem) ? "PerformInsert" : "Update" %>'>
</
asp:Button
>
<
asp:Button
ID
=
"btnCancel"
Text
=
"Cancel"
runat
=
"server"
CausesValidation
=
"False"
CommandName
=
"Cancel"
></
asp:Button
>
</
td
>
</
tr
>
</
table
>
</
FormTemplate
>
</
EditFormSettings
>
</
MasterTableView
>
</
telerik:RadGrid
>
<
asp:SqlDataSource
ID
=
"SqlDataSource1"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:Northwind_newConnectionString3 %>"
DeleteCommand="DELETE FROM [Orders] WHERE [OrderID] = @OrderID" InsertCommand="INSERT INTO [Orders] ([ShipCity], [ShipName]) VALUES (@ShipCity, @ShipName)"
SelectCommand="SELECT * FROM [Orders]" UpdateCommand="UPDATE [Orders] SET [ShipCity] = @ShipCity, [ShipName] = @ShipName WHERE [OrderID] = @OrderID">
<
DeleteParameters
>
<
asp:Parameter
Name
=
"OrderID"
Type
=
"Int32"
></
asp:Parameter
>
</
DeleteParameters
>
<
InsertParameters
>
<
asp:Parameter
Name
=
"ShipCity"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"ShipName"
Type
=
"String"
></
asp:Parameter
>
</
InsertParameters
>
<
UpdateParameters
>
<
asp:Parameter
Name
=
"ShipCity"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"ShipName"
Type
=
"String"
></
asp:Parameter
>
<
asp:Parameter
Name
=
"OrderID"
Type
=
"Int32"
></
asp:Parameter
>
</
UpdateParameters
>
</
asp:SqlDataSource
>
</
asp:Content
>
Thanks,
Princy
0
Jocelyn
Top achievements
Rank 1
answered on 04 Oct 2013, 07:40 PM
Hi Princy,
Thanks alot for your help. The problem was this property:
When I set it to false, the problem is gone.
Thanks!
Thanks alot for your help. The problem was this property:
tmpGrid.ClientSettings.AllowKeyboardNavigation =
True
When I set it to false, the problem is gone.
Thanks!