5 Answers, 1 is accepted
This is the reply I got from a Telerik Support Ticket:
Unfortunately the described behavior is expected, because the document.unload is raised because of the desire to change the value of the input control.
If you have any ideas, I would greatly appreciate it. Here is my javascript:
1 var needToConfirm = true; |
2 window.onbeforeunload = confirmExit; |
3 function confirmExit() { |
4 if (needToConfirm) { |
5 return "You will lose all unsaved data."; |
6 } |
7 } |
8 function disableConfirmExit() { |
9 needToConfirm = false; |
10 } |
And here is my control:
1 <telerik:RadNumericTextBox ID="LocationCountRadNumericTextBox" runat="server" ShowSpinButtons="true" |
2 MinValue="1" MaxValue="30" Type="Number" MaxLength="2" Value="1" Width="40px" |
3 OnTextChanged="LocationCountRadNumericTextBox_TextChanged" AutoPostBack="true"> |
4 <IncrementSettings InterceptArrowKeys="true" InterceptMouseWheel="true" /> |
5 <NumberFormat DecimalDigits="0" GroupSeparator="" AllowRounding="true" |
6 KeepNotRoundedValue="false" /> |
7 <ClientEvents OnKeyPress="RadNumericTextBoxKeyPress" OnButtonClick="disableConfirmExit" /> |
8 </telerik:RadNumericTextBox> |
This seems to work, but inconsistently. The OnButtonClick client event calls the disableConfirmExit JavaScript function to set the needToConfirm value to false, and the OnTextChanged server event re-sets the needToConfirm value back to true. This method works with my LinkButtons and Button controls, but after clicking the spin buttons a few times the prompt is displayed. There isn't a pattern as to when it's displayed, either.
After posing this to the Telerik Support Person, here was their response:
I was able to reproduce the described behavior on IE browser. I could not replicate this issue in FF. I suppose that the cause of this abnormality is the speed of the implementation of JavaScript code, which is slower in IE. Unfortunately my abilities to help you further with this problem are depleted.
Thanks for any advice you might provide!
am using following grid
<table id="tblUpper" width="100%" cellpadding="0" cellspacing="0" style="table-layout: fixed;">
<tr>
<td valign="top">
<telerik:RadGrid ID="RadGridClientMandate" GridLines="None" runat="server" AutoGenerateColumns="False"
Skin="3iGrid" EnableEmbeddedSkins="false" Height="390px" Width="99.5%">
<MasterTableView InsertItemDisplay="Bottom" Width="100%" DataKeyNames="Security"
Visible="true">
<RowIndicatorColumn>
<HeaderStyle Width="20px" />
</RowIndicatorColumn>
<ExpandCollapseColumn>
<HeaderStyle Width="20px" />
</ExpandCollapseColumn>
<Columns>
<telerik:GridTemplateColumn HeaderText="Asset Type" UniqueName="Asset_type" Visible="true">
<ItemTemplate>
<asp:Label ID="Asset_type" runat="server" Text='<%# Bind("Asset_type") %>' />
</ItemTemplate>
</telerik:GridTemplateColumn>
<
telerik:GridTemplateColumn HeaderText="Mandate Qty" UniqueName="Mandate Qty">
<ItemTemplate>
<telerik:RadNumericTextBox ID="MandateQty" runat="server" CssClass="input" Skin="Office2007" ReadOnly="True" EnabledStyle-BackColor="White"
MaxLength="18" DbValue='<%# Bind("MandateQty") %>' OnTextChanged="MandateQty_OnTextChanged" NumberFormat-GroupSeparator=","
Width="80px" >
<NumberFormat AllowRounding="True" KeepNotRoundedValue="False" />
<DisabledStyle HorizontalAlign="Right"/>
<EmptyMessageStyle HorizontalAlign="Right" />
<FocusedStyle HorizontalAlign="Right" />
<HoveredStyle HorizontalAlign="Right" />
<NegativeStyle HorizontalAlign="Right" />
<ReadOnlyStyle HorizontalAlign="Right" />
<EnabledStyle HorizontalAlign="Right" />
<InvalidStyle HorizontalAlign="Right" />
<NumberFormat DecimalDigits = "2" />
</telerik:RadNumericTextBox>
</ItemTemplate>
</
Columns>
</MasterTableView>
<ClientSettings>
<Scrolling AllowScroll="True" />
<Resizing AllowColumnResize="True" />
</ClientSettings>
</telerik:RadGrid>
</td>
</tr>
</table>
i have used radnumerictextbox with OnTextChange event , but event is not get fired plz help me
Hi princy,
Thnaks for your code it works!!!
now i hav another doubt
am using follwing type of grid....
<table id="tblUpper" width="100%" cellpadding="0" cellspacing="0" style="table-layout: fixed;">
<tr><td valign="top">
<telerik:RadGrid ID="RadGridClientMandate" GridLines="None" runat="server" AutoGenerateColumns="False"
OnItemDataBound="drmandates_ItemDataBound" Skin="3iGrid" EnableEmbeddedSkins="false"
Height="390px" Width="99.5%">
<MasterTableView InsertItemDisplay="Bottom" Width="100%" DataKeyNames="Security"Visible="true">
<RowIndicatorColumn>
<HeaderStyle Width="20px" />
</RowIndicatorColumn><ExpandCollapseColumn>
<HeaderStyle Width="20px" />
</ExpandCollapseColumn><Columns>
<telerik:GridTemplateColumn HeaderText="Asset Type" UniqueName="Asset_type" Visible="true">
<ItemTemplate>
<asp:Label ID="Asset_type" runat="server" Text='<%# Bind("Asset_type") %>' />
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Security" UniqueName="Security" Visible="true">
<ItemTemplate>
<asp:Label ID="Security" runat="server" Text='<%# Bind("Security") %>' />
</ItemTemplate>
</telerik:GridTemplateColumn>
<telerik:GridTemplateColumn HeaderText="Price" ItemStyle-HorizontalAlign="Right" UniqueName="Price">
<ItemTemplate>
<telerik:RadNumericTextBox ID="Price" runat="server" CssClass="input" Skin="Office2007"
ReadOnly="false" EnabledStyle-BackColor="White" MaxLength="18" DbValue='<%# Bind("Price") %>'
EnableEmbeddedSkins ="false" NumberFormat-GroupSeparator="," Width="80px"
AutoPostBack="true">
<NumberFormat AllowRounding="True" KeepNotRoundedValue="False" />
<DisabledStyle HorizontalAlign= "Right" />
<EmptyMessageStyle HorizontalAlign="Right" />
<FocusedStyle HorizontalAlign="Right" />
<HoveredStyle HorizontalAlign="Right" />
<NegativeStyle HorizontalAlign="Right" />
<ReadOnlyStyle HorizontalAlign="Right" />
<EnabledStyle HorizontalAlign="Right" />
<InvalidStyle HorizontalAlign="Right" />
<NumberFormat DecimalDigits="2" />
</telerik:RadNumericTextBox>
</ItemTemplate>
</telerik:GridTemplateColumn>
</Columns>
</MasterTableView>
<ClientSettings>
<Scrolling AllowScroll="True" />
<Resizing AllowColumnResize="True" />
</ClientSettings>
</telerik:RadGrid>
</td></tr></table>
am using ranumerictextbox for editable column,
now i need to use radnumerictextbox as label column in my grid, it shud no visible as editable r textbox, it shud be as such as normal labe field
and i hav grid with alternate color for alternate rows ,so my radnumerictextbox shud be viewed with grid bgcolor
plz help me