or
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"radgrid1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"radgrid1"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"hdnRowsCount"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
telerik:RadAjaxLoadingPanel
ID
=
"RadAjaxLoadingPanel1"
runat
=
"server"
Height
=
"75px"
Width
=
"75px"
Transparency
=
"25"
>
<
img
alt
=
"Loading..."
src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>'
style="border: 0;" /></
telerik:RadAjaxLoadingPanel
>
<
asp:HiddenField
ID
=
"hdnRowsCount"
runat
=
"server"
Value
=
"0"
/>
<
telerik:RadGrid
ID
=
"radgrid1"
runat
=
"server"
ShowStatusBar
=
"True"
ShowFooter
=
"True"
OnItemCommand
=
"radgrid1_ItemCommand"
OnDeleteCommand
=
"radgrid1_DeleteCommand"
OnInsertCommand
=
"radgrid1_InsertCommand"
OnUpdateCommand
=
"radgrid1_UpdateCommand"
OnNeedDataSource
=
"radgrid1_NeedDataSource"
onitemdatabound
=
"radgrid1_ItemDataBound"
CellSpacing
=
"0"
GridLines
=
"None"
>
<
MasterTableView
DataKeyNames
=
"ProductNumber"
AutoGenerateColumns
=
"false"
EditMode
=
"InPlace"
CommandItemDisplay
=
"TopAndBottom"
CommandItemSettings-AddNewRecordText
=
"Add New Purchase Order"
>
<
Columns
>
</
columns
>
<
asp:Panel
ID
=
"PnlRequest"
runat
=
"server"
>
For testing purposes i am using one table only.
The table Design is
ProductID autonumber
ID int
ProductName Varchar(100)
Price Varchar(150)
Then i also added DataType=DataType=System.Decimal then i get an error
This is my ASPX code
<
asp:Content
ID
=
"Content2"
ContentPlaceHolderID
=
"contentplaceholder1"
runat
=
"server"
>
<
telerik:RadScriptManager
runat
=
"server"
ID
=
"RadScriptManager1"
/>
<
telerik:RadSkinManager
ID
=
"QsfSkinManager"
runat
=
"server"
ShowChooser
=
"true"
/>
<
telerik:RadFormDecorator
ID
=
"QsfFromDecorator"
runat
=
"server"
DecoratedControls
=
"All"
EnableRoundedCorners
=
"false"
/>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadGrid1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadGrid1"
></
telerik:AjaxUpdatedControl
>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
telerik:RadGrid
ID
=
"RadGrid1"
Width
=
"100%"
AllowSorting
=
"True"
ShowFooter
=
"True"
PageSize
=
"15"
AllowPaging
=
"True"
AllowMultiRowSelection
=
"True"
ShowChooser
=
"true"
runat
=
"server"
GridLines
=
"None"
AutoGenerateColumns
=
"False"
CellSpacing
=
"0"
DataSourceID
=
"ObjectDataSource1"
>
<
MasterTableView
Width
=
"100%"
Summary
=
"RadGrid table"
RetrieveAllDataFields
=
"false"
DataSourceID
=
"ObjectDataSource1"
>
<
CommandItemSettings
ExportToPdfText
=
"Export to PDF"
></
CommandItemSettings
>
<
RowIndicatorColumn
Visible
=
"True"
FilterControlAltText
=
"Filter RowIndicator column"
>
</
RowIndicatorColumn
>
<
ExpandCollapseColumn
Visible
=
"True"
FilterControlAltText
=
"Filter ExpandColumn column"
>
</
ExpandCollapseColumn
>
<
Columns
>
<
telerik:GridBoundColumn
DataField
=
"Productid"
HeaderText
=
"Productid"
DataType
=
"System.Int32"
SortExpression
=
"Productid"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"id"
HeaderText
=
"id"
DataType
=
"System.Int32"
FilterControlAltText
=
"Filter id column"
SortExpression
=
"id"
UniqueName
=
"id"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"ProductName"
HeaderText
=
"ProductName"
FilterControlAltText
=
"Filter ProductName column"
SortExpression
=
"ProductName"
UniqueName
=
"ProductName"
>
</
telerik:GridBoundColumn
>
<
telerik:GridBoundColumn
DataField
=
"Price"
HeaderText
=
"Price"
SortExpression
=
"Price"
Aggregate
=
"Sum"
FooterText
=
"Total price: "
>
</
telerik:GridBoundColumn
>
</
Columns
>
<
EditFormSettings
>
<
EditColumn
FilterControlAltText
=
"Filter EditCommandColumn column"
>
</
EditColumn
>
</
EditFormSettings
>
</
MasterTableView
>
<
PagerStyle
Mode
=
"NextPrevAndNumeric"
></
PagerStyle
>
<
FilterMenu
EnableImageSprites
=
"False"
>
</
FilterMenu
>
</
telerik:RadGrid
>
<
asp:ObjectDataSource
ID
=
"ObjectDataSource1"
runat
=
"server"
SelectMethod
=
"GetListProduct"
TypeName
=
"Business.ProductManager"
></
asp:ObjectDataSource
>
</
asp:Content
>
/////////////////////////////////////////////////////////////////////////
public static ProductList GetListProduct()
{
ProductList tempList = null;
string sql = "SELECT * from Product";
//using (SqlConnection myConnection = new SqlConnection(AppConfig.ConnectionString))
using (SqlConnection myConnection = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["NLayer"].ConnectionString))
{
using (SqlCommand myCommand = new SqlCommand(sql, myConnection))
{
myConnection.Open();
using (SqlDataReader myReader = myCommand.ExecuteReader())
{
if (myReader.HasRows)
{
tempList = new ProductList();
while (myReader.Read())
{
tempList.Add(FillDataRecordProduct(myReader));
}
}
myReader.Close();
}
}
return tempList;
}
}
private static Product FillDataRecordProduct(IDataRecord myDataRecord)
{
Product myUserTracking = new Product();
myUserTracking.Productid = myDataRecord.GetInt32(myDataRecord.GetOrdinal("Productid"));
myUserTracking.id = myDataRecord.GetInt32(myDataRecord.GetOrdinal("id"));
myUserTracking.ProductName = myDataRecord.GetString(myDataRecord.GetOrdinal("ProductName"));
myUserTracking.Price = myDataRecord.GetString(myDataRecord.GetOrdinal("Price"));
return myUserTracking;
}
public
override
string
ToString()
{
//LosFormatter formatter = new LosFormatter();
BinaryFormatter formatter =
new
BinaryFormatter();
//using (StringWriter writer = new StringWriter())
using
(MemoryStream writer =
new
MemoryStream())
{
formatter.Serialize(writer,
this
);
string
arr = writer.ToString();
return
arr.ToString();
}
}
/// <summary>
/// Gets the GridSettingsCollectionInstance from its serialized string data
/// </summary>
/// <param name="data">The object as serialized string data</param>
public
static
GridSettingsCollection LoadFromSerializedData(
string
data)
{
//LosFormatter formatter = new LosFormatter();
BinaryFormatter formatter =
new
BinaryFormatter();
byte
[] arr = System.Text.Encoding.ASCII.GetBytes(data);
MemoryStream stream =
new
MemoryStream(arr);
//return (GridSettingsCollection)formatter.Deserialize(data);
return
(GridSettingsCollection)formatter.Deserialize(stream);
}
Hi,
I am using Sharepoint 2010. I have added the rad grid and i also added the radajax manager.
I would like to know the difference between "RadAjaxManager and RadScriptManager" and whcih should be used in sharepoint 2010?
Below is the radajax code i have used:
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"radgrid1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"radgrid1"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
/>
<
telerik:AjaxUpdatedControl
ControlID
=
"hdnRowsCount"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
telerik:RadAjaxLoadingPanel
ID
=
"RadAjaxLoadingPanel1"
runat
=
"server"
Height
=
"75px"
Width
=
"75px"
Transparency
=
"25"
>
<
img
alt
=
"Loading..."
src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>'
style="border: 0;" /></
telerik:RadAjaxLoadingPanel
>
RadAjaxManager ajaxmgr;
protected
override
void
CreateChildControls()
{
Control control = Page.LoadControl(_ascxPath);
Controls.Add(control);
RadAjaxLoadingPanel loadingPanel = control.FindControl(
"RadAjaxLoadingPanel1"
)
as
RadAjaxLoadingPanel;
RadGrid grid = control.FindControl(
"radgrid1"
)
as
RadGrid;
//Find more controls to add to the ajax settings
if
(ajaxmgr !=
null
)
{
ajaxmgr.AjaxSettings.AddAjaxSetting(grid, grid, loadingPanel);
}
}
protected
override
void
OnInit(EventArgs e)
{
base
.OnInit(e);
ajaxmgr = RadAjaxManager.GetCurrent(Page);
if
(ajaxmgr ==
null
)
{
ajaxmgr =
new
RadAjaxManager();
Page.Items.Add(
typeof
(RadAjaxManager), ajaxmgr);
}
if
(Page.Form !=
null
)
{
Page.Form.Controls.AddAt(0, ajaxmgr);
}
EnsureChildControls();
}