Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: Input string was not in a correct format.
How can I have my cake and eat it too? I want to Display percentages as whole numbers and edit them the same way?
grid is named rdAsset
<
telerik:GridBoundColumn DataField="Target" DataType="System.Decimal" DataFormatString="{0:p2}" HeaderText="Target%" SortExpression="Target" UniqueName="Target">
</telerik:GridBoundColumn>
<telerik:GridBoundColumn DataField="TargetRange" DataType="System.Decimal" DataFormatString="{0:p2}"
HeaderText="Target Range%" SortExpression="TargetRange" UniqueName="TargetRange">
</telerik:GridBoundColumn>
In the code behind, I have...
protected void rdAsset_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e)
{
if (e.Item is GridEditableItem && (e.Item as GridEditableItem).IsInEditMode )
{
GridEditFormItem item = e.Item as GridEditFormItem;
TextBox target = item["Target"].Controls[0] as TextBox;
target.Text =
String.Format("{0:p2}", (item.DataItem as DataRowView).Row["Target"]);
TextBox targetRange = item["TargetRange"].Controls[0] as TextBox;
targetRange.Text =
String.Format("{0:p2}", (item.DataItem as DataRowView).Row["TargetRange"]);
}
I've seen a couple other posts about this, but none of them had an answer that actually worked. My problem is that I have a RadGrid inside of a RadMultiPage, and I'm using RadAjaxManager. Whenever I click to go to the next page, or change the page size, or anything of that nature, the RadGrid disappears. When looking at the source code the markup for the RadGrid does not appear, just a couple of div tags in its place. This is the code on my .aspx page:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CreateAccount.aspx.cs" Inherits="DADCA.Account.CreateAccount" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
id
=
"Head1"
runat
=
"server"
>
<
title
>Dayton Defense - Login</
title
>
<
link
href
=
"~/Styles/Site.css"
rel
=
"stylesheet"
type
=
"text/css"
/>
<
style
type
=
"text/css"
>
/*the following CSS rules take care of expanding the html, body and form elements
in case the page content is shorter than the browser window viewport.*/
html,
body,
form
{
min-height:100%; /*all except IE6*/
margin:0;
padding:0;
}
* html html,
* html body,
* html form
{
height:100%; /*IE6 only*/
}
.MyModalPanel
{
position:absolute;
}
</
style
>
</
head
>
<
body
style
=
"background: #fff; "
>
<
form
id
=
"page_form"
runat
=
"server"
>
<
div
style
=
"width:500px; margin: 20px auto 0px auto !important;"
>
<
telerik:RadScriptManager
ID
=
"LoginRadScriptManager"
runat
=
"server"
/>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadSubmitButton"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"createAccountMultiPage"
LoadingPanelID
=
"win7LoadingPanel"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
<
telerik:AjaxSetting
AjaxControlID
=
"companySearchResultsGrid"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"createAccountPanel"
LoadingPanelID
=
"win7LoadingPanel"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"companySearchResultsGrid"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"createAccountMultiPage"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
telerik:RadAjaxLoadingPanel
ID
=
"win7LoadingPanel"
runat
=
"server"
CssClass
=
"MyModalPanel"
Skin
=
"Windows7"
IsSticky
=
"true"
Width
=
"100%"
Height
=
"100%"
/>
<
telerik:RadMultiPage
ID
=
"createAccountMultiPage"
runat
=
"server"
Width
=
"100%"
>
<
telerik:RadPageView
ID
=
"companySearchView"
runat
=
"server"
Selected
=
"true"
>
<
table
width
=
"100%"
align
=
"center"
>
<
tr
>
<
td
> </
td
>
</
tr
>
<
tr
>
<
td
width
=
"40%"
align
=
"left"
>
<
img
src
=
"../Images/DaytonDefenseLogo.jpg"
alt
=
"Dayton Defense Logo"
width
=
"100%"
/>
</
td
>
<
td
width
=
"5%"
></
td
>
<
td
align
=
"left"
valign
=
"top"
width
=
"55%"
>
<
h1
>Register</
h1
>
</
td
>
</
tr
>
<
tr
><
td
> </
td
></
tr
>
</
table
>
<
table
width
=
"100%"
align
=
"center"
>
<
tr
>
<
td
colspan
=
"3"
align
=
"center"
>
Please enter your company's name in the textbox below and click "Submit".<
br
/><
br
/>
This will search our database to see if a record of your company already exists.
</
td
>
</
tr
>
<
tr
>
<
td
colspan
=
"3"
align
=
"center"
>
<
span
class
=
"failureNotification"
>
<
span
style
=
"color: Red"
>
<
asp:Label
ID
=
"errorLabel"
runat
=
"server"
Visible
=
"false"
/>
</
span
>
</
span
>
</
td
>
</
tr
>
<
tr
><
td
> </
td
></
tr
>
<
tr
>
<
td
width
=
"48%"
align
=
"right"
>
<
span
id
=
"asterikSpan"
style
=
"color:Red;"
runat
=
"server"
visible
=
"false"
>*</
span
>Company Name:
</
td
>
<
td
width
=
"2%"
> </
td
>
<
td
align
=
"left"
>
<
telerik:RadTextBox
ID
=
"companyName"
runat
=
"server"
Skin
=
"Windows7"
/>
</
td
>
</
tr
>
<
tr
><
td
> </
td
></
tr
>
<
tr
>
<
td
colspan
=
"3"
align
=
"center"
>
<
telerik:RadButton
ID
=
"RadSubmitButton"
runat
=
"server"
OnClick
=
"RadSubmitButton_OnClick"
Text
=
"Submit"
Skin
=
"Windows7"
Width
=
"150px"
ValidationGroup
=
"LoginUserValidationGroup"
/>
</
td
>
</
tr
>
</
table
>
</
telerik:RadPageView
>
<
telerik:RadPageView
ID
=
"companySearchResultsView"
runat
=
"server"
>
<
table
width
=
"100%"
align
=
"center"
>
<
tr
>
<
td
> </
td
>
</
tr
>
<
tr
>
<
td
width
=
"40%"
align
=
"left"
>
<
img
src
=
"../Images/DaytonDefenseLogo.jpg"
alt
=
"Dayton Defense Logo"
width
=
"100%"
/>
</
td
>
<
td
width
=
"5%"
></
td
>
<
td
align
=
"left"
valign
=
"top"
>
<
h1
>Register</
h1
>
</
td
>
</
tr
>
<
tr
><
td
> </
td
></
tr
>
</
table
>
<
table
width
=
"95%"
align
=
"center"
>
<
tr
>
<
td
colspan
=
"3"
align
=
"right"
width
=
"100%"
>
<
telerik:RadButton
ID
=
"backToSearchButton"
runat
=
"server"
Text
=
"Back To Company Search"
Skin
=
"Windows7"
OnClick
=
"backToSearchButton_OnClick"
/>
</
td
>
</
tr
>
<
tr
><
td
> </
td
></
tr
>
<
tr
>
<
td
colspan
=
"3"
align
=
"center"
width
=
"100%"
>
Below are the results of your search.
</
td
>
</
tr
>
<
tr
>
<
td
colspan
=
"3"
align
=
"center"
>
If you see your company listed, click on the check mark to view details about your company and how to create your user account.
</
td
>
</
tr
>
<
tr
><
td
> </
td
></
tr
>
<
tr
>
<
td
colspan
=
"3"
>
<
telerik:RadGrid
ID
=
"companySearchResultsGrid"
runat
=
"server"
AllowFilteringByColumn
=
"True"
AllowSorting
=
"True"
GridLines
=
"None"
AllowPaging
=
"True"
Skin
=
"Windows7"
PageSize
=
"20"
OnSelectedIndexChanged
=
"companySearchResultsGrid_SelectedIndexChanged"
AutoGenerateColumns
=
"False"
>
<
MasterTableView
DataKeyNames
=
"id"
Width
=
"100%"
>
<
CommandItemSettings
ExportToPdfText
=
"Export to Pdf"
></
CommandItemSettings
>
<
RowIndicatorColumn
FilterControlAltText
=
"Filter RowIndicator column"
>
<
HeaderStyle
Width
=
"20px"
></
HeaderStyle
>
</
RowIndicatorColumn
>
<
ExpandCollapseColumn
FilterControlAltText
=
"Filter ExpandColumn column"
>
<
HeaderStyle
Width
=
"20px"
></
HeaderStyle
>
</
ExpandCollapseColumn
>
<
Columns
>
<
telerik:GridButtonColumn
CommandName
=
"Select"
ButtonType
=
"ImageButton"
ImageUrl
=
"~/Images/action_check.png"
HeaderStyle-Width
=
"8px"
ItemStyle-Width
=
"8px"
/>
<
telerik:GridBoundColumn
DataField
=
"name"
FilterControlAltText
=
"Filter By Company Name"
HeaderText
=
"Company Name"
SortExpression
=
"name"
UniqueName
=
"name"
>
</
telerik:GridBoundColumn
>
</
Columns
>
</
MasterTableView
>
<
FilterMenu
EnableImageSprites
=
"False"
></
FilterMenu
>
<
HeaderContextMenu
CssClass
=
"GridContextMenu GridContextMenu_Default"
></
HeaderContextMenu
>
</
telerik:RadGrid
>
<
asp:SqlDataSource
ID
=
"companySearchResultsDS"
runat
=
"server"
ConnectionString="<%$ ConnectionStrings:DADCAConnectionString %>" />
</
td
>
</
tr
>
<
tr
><
td
> </
td
></
tr
>
<
tr
>
<
td
colspan
=
"3"
align
=
"left"
>
Don't see your company? <
a
href
=
"#"
>Click here</
a
> to continue registration for a new company.
</
td
>
</
tr
>
<
tr
><
td
> </
td
></
tr
>
</
table
>
</
telerik:RadPageView
>
<
telerik:RadPageView
ID
=
"companyDetailsView"
runat
=
"server"
>
<
table
width
=
"100%"
align
=
"center"
>
<
tr
>
<
td
> </
td
>
</
tr
>
<
tr
>
<
td
width
=
"40%"
align
=
"left"
>
<
img
src
=
"../Images/DaytonDefenseLogo.jpg"
alt
=
"Dayton Defense Logo"
width
=
"100%"
/>
</
td
>
<
td
width
=
"5%"
></
td
>
<
td
align
=
"left"
valign
=
"top"
>
<
h1
><
asp:Label
ID
=
"results_company_header_label"
runat
=
"server"
></
asp:Label
></
h1
>
</
td
>
</
tr
>
<
tr
><
td
> </
td
></
tr
>
</
table
>
<
table
width
=
"95%"
align
=
"center"
>
<
tr
>
<
td
colspan
=
"3"
align
=
"right"
width
=
"100%"
>
<
telerik:RadButton
ID
=
"backToSearchResults"
runat
=
"server"
Text
=
"Back To Company Search Results"
Skin
=
"Windows7"
OnClick
=
"backToSearchResultsButton_OnClick"
/>
</
td
>
</
tr
>
<
tr
><
td
> </
td
></
tr
>
<
tr
>
<
td
colspan
=
"3"
align
=
"center"
width
=
"100%"
>
We currently have a record of your company in our database.<
br
/><
br
/>
The point of contact (POC) for your company is:
</
td
>
</
tr
>
<
tr
><
td
> </
td
></
tr
>
<
tr
>
<
td
colspan
=
"3"
align
=
"center"
>
POC details
</
td
>
</
tr
>
<
tr
><
td
> </
td
></
tr
>
<
tr
>
<
td
colspan
=
"3"
>
</
td
>
</
tr
>
<
tr
><
td
> </
td
></
tr
>
<
tr
>
<
td
colspan
=
"3"
align
=
"left"
>
</
td
>
</
tr
>
</
table
>
</
telerik:RadPageView
>
</
telerik:RadMultiPage
>
<
script
language
=
"javascript"
type
=
"text/javascript"
>
function GetRadWindow() {
var oWindow = null;
if (window.radWindow) oWindow = window.radWindow;
else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
return oWindow;
}
function CancelWindow() {
var wnd = GetRadWindow();
wnd.close();
}
function CloseWndw() {
var wnd = GetRadWindow();
wnd.close();
}
function Waiting(s, e) {
Callback.PerformCallback();
LPWaitConn.Show();
}
function RequestStart(sender, args) {
if ($telerik.isSafari) {
var scrollTopOffset = document.body.scrollTop;
var scrollLeftOffset = document.body.scrollLeft;
}
else {
var scrollTopOffset = document.documentElement.scrollTop;
var scrollLeftOffset = document.documentElement.scrollLeft;
}
var loadingImageWidth = 55;
var loadingImageHeight = 55;
loadingPanel.style.backgroundPosition = (parseInt(scrollLeftOffset) + parseInt(viewportWidth / 2) - parseInt(loadingImageWidth / 2)) + "px " + (parseInt(scrollTopOffset) + parseInt(viewportHeight / 2) - parseInt(loadingImageHeight / 2)) + "px";
}
</
script
>
<
asp:Label
ID
=
"successLabel"
runat
=
"server"
/>
</
div
>
</
form
>
</
body
>
</
html
>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Web.UI;
using DADCA.Authentication;
namespace DADCA.Account
{
public partial class CreateAccount : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack)
{
companySearchResultsGrid.DataSource = companySearchResultsDS;
companySearchResultsGrid.DataBind();
}
}
protected void RadSubmitButton_OnClick(object sender, EventArgs e)
{
if (companyName.Text != null && companyName.Text != "")
{
//Get the parameters for the query based on the company name the user gave us
List<
string
> parameters = companyName.Text.Split(' ').ToList<
string
>();
if (parameters != null && parameters.Count > 0)
{
//Set the SQL query of the data source
string sql = "SELECT [Companies].id, [Companies].name FROM Companies WHERE ";
foreach (string p in parameters)
{
sql += "[Companies].name LIKE '%" + p + "%' OR ";
}
sql = sql.Substring(0, sql.Length - 4); //Trim off the last ' OR '
//Set the select command of the data source
companySearchResultsDS.SelectCommand = sql;
//Assign the data source and rebind
companySearchResultsGrid.DataSource = companySearchResultsDS;
companySearchResultsGrid.DataBind();
//Change to the correct page view
companySearchResultsView.Selected = true;
//Get rid of any errors that may be there
errorLabel.Visible = false;
asterikSpan.Visible = false;
}
}
else
{
errorLabel.Text = "You must supply your company name to continue.";
errorLabel.Visible = true;
asterikSpan.Visible = true;
}
}
protected void companySearchResultsGrid_SelectedIndexChanged(object sender, EventArgs e)
{
var selectedCompany = companySearchResultsGrid.SelectedItems[0] as GridDataItem;
if (selectedCompany != null)
{
string key = selectedCompany.GetDataKeyValue("id").ToString();
//Once we have the ID of the company the user selected, show them the company's details
//along with information on how to get added as a user
}
}
protected void backToSearchButton_OnClick(object sender, EventArgs e)
{
//Make sure we aren't showing any errors when we go back
errorLabel.Visible = false;
asterikSpan.Visible = false;
companySearchView.Selected = true;
}
protected void backToSearchResultsButton_OnClick(object sender, EventArgs e)
{
}
}
}
Hi Everyone,
Problem Statement: Inside of an ASP DetailsView, I have declared a RadEditor. The content is bound inline with the content property. When the field is empty, I need to display a stylized (greyed out or whatever..) set of template text. This is to help the users properly fill in the field. I can't seem to figure out the best way to accomplish this.
Tried so far: Bind the content inline, and also put the template text in the content tags within the control declaration.
Is there something I can do in the DetailsView databind to check the contents then post the template text?
Here is the way I am binding this now:
<
asp:TemplateField
HeaderText
=
"Summary"
SortExpression
=
"Summary"
>
<
EditItemTemplate
>
<
telerik:RadEditor
ID
=
"reSummary"
runat
=
"server"
Height
=
"80"
Width
=
"500"
ToolsFile
=
"xml\RadEditorToolbars.xml"
Content='<%# Bind("Summary") %>'>
<
CssFiles
>
<
telerik:EditorCssFile
Value
=
"Styles/EditorContentArea.css"
/>
</
CssFiles
>
</
telerik:RadEditor
>
<
br
/>
<
br
/>
<
br
/>
</
EditItemTemplate
>
<
InsertItemTemplate
>
<
asp:TextBox
ID
=
"TextBox3"
runat
=
"server"
Text='<%# Bind("Summary") %>'></
asp:TextBox
>
</
InsertItemTemplate
>
<
ItemTemplate
>
<
asp:Label
ID
=
"Label3"
runat
=
"server"
Text='<%# Bind("Summary") %>'></
asp:Label
>
</
ItemTemplate
>
<
ControlStyle
Width
=
"600px"
/>
<
HeaderStyle
HorizontalAlign
=
"Right"
VerticalAlign
=
"Top"
Width
=
"600px"
/>
</
asp:TemplateField
>