I have a very basic grid with the ability to add records directly to it. When you click Add Record, you get a blank grid until a postback. If you click the foo button, you'll see the grid comes back in add mode. I tried adding an RadAjaxPanel and a RadAjaxManager, but neither fixed the issue.
Help!
Help!
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Default" %>
<!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
runat
=
"server"
>
<
title
></
title
>
<
telerik:RadStyleSheetManager
id
=
"RadStyleSheetManager1"
runat
=
"server"
/>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
>
<
Scripts
>
<%--Needed for JavaScript IntelliSense in VS2010--%>
<%--For VS2008 replace RadScriptManager with ScriptManager--%>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.Core.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQuery.js"
/>
<
asp:ScriptReference
Assembly
=
"Telerik.Web.UI"
Name
=
"Telerik.Web.UI.Common.jQueryInclude.js"
/>
</
Scripts
>
</
telerik:RadScriptManager
>
<
script
type
=
"text/javascript"
>
</
script
>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"cartgrdItems"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"cartgrdItems"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
div
>
<
telerik:RadAjaxPanel
runat
=
"server"
ID
=
"foo"
EnableAJAX
=
"true"
ViewStateMode
=
"Enabled"
>
<
telerik:RadGrid
runat
=
"server"
ID
=
"cartgrdItems"
>
<
MasterTableView
EnableNoRecordsTemplate
=
"true"
CommandItemDisplay
=
"Top"
EditMode
=
"InPlace"
>
<
CommandItemSettings
ShowAddNewRecordButton
=
"true"
AddNewRecordText
=
"Add Item"
/>
</
MasterTableView
>
</
telerik:RadGrid
>
<
telerik:RadButton
runat
=
"server"
ID
=
"bar"
text
=
"foo"
onclick
=
"bar_Click"
/>
</
telerik:RadAjaxPanel
>
</
div
>
</
form
>
</
body
>
</
html
>
using
System;
using
System.Collections.Generic;
using
System.Web.UI;
public
partial
class
Default : System.Web.UI.Page
{
protected
void
Page_Load(
object
sender, EventArgs e)
{
if
(!Page.IsPostBack)
{
List<ApprovalDetail> foo =
new
List<ApprovalDetail>();
cartgrdItems.DataSource =
new
Object[0];
cartgrdItems.DataSource = foo;
cartgrdItems.DataBind();
}
}
protected
void
bar_Click(
object
sender, EventArgs e)
{
}
[Serializable]
public
class
ApprovalDetail
{
public
string
PRNumber {
get
;
set
; }
public
int
ItemNumber {
get
;
set
; }
public
string
ItemNumberCode {
get
;
set
; }
public
string
ItemUOM {
get
;
set
; }
public
decimal
ItemUnit {
get
;
set
; }
public
string
ItemMatGroup {
get
;
set
; }
}
}