Dim
uxRadGrid
As
Telerik.Web.UI.RadGrid =
DirectCast
(uxFormView.FindControl(
"uxRadGrid"
), RadGrid)
uxRadGrid.ItemDataBound +=
New
GridItemEventHandler(uxRadGrid_ItemDataBound)
I implemented the second type of virtual scrolling on the following page.
http://www.telerik.com/help/aspnet-ajax/grid-virtual-scrolling.html
I created a more flexible implementation while adding 100% height functionality.
<!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
>
<
style
type
=
"text/css"
>
html, body, form
{
height: 100%;
width: 100%;
margin: 0px;
padding: 0px;
}
</
style
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
/>
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadGrid1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadGrid1"
LoadingPanelID
=
"RadAjaxLoadingPanel1"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
<
telerik:RadAjaxLoadingPanel
ID
=
"RadAjaxLoadingPanel1"
runat
=
"server"
/>
<
script
type
=
"text/javascript"
>
var activeGrid;
function RadGrid1_OnGridCreated(sender, e) {
activeGrid = sender;
RadGrid1_Resize();
}
function RadGrid1_Resize() {
setTimeout(function () {
if (!activeGrid) return;
var scrollDiv = activeGrid.GridDataDiv;
if (scrollDiv) {
var scrollHeight = document.body.offsetHeight - scrollDiv.offsetTop;
var footer = activeGrid.GridFooterDiv;
if (footer) {
scrollHeight -= footer.offsetHeight;
}
var pager = activeGrid.PagerControl;
if (pager) {
scrollHeight -= pager.offsetHeight;
}
scrollDiv.style.height = scrollHeight - 2 + "px";
}
}, 0);
}
window.onresize = window.onload = RadGrid1_Resize;
function RadGrid1_OnScroll(sender, eventArgs) {
if (eventArgs.isOnBottom) {
var masterTableView = sender.MasterTableView;
if (masterTableView.PageSize * (masterTableView.CurrentPageIndex + 1) <
masterTableView.get_virtualItemCount
()) {
masterTableView.fireCommand("PageSizeIncrease", "50");
}
}
}
</script>
test
<
div
>
<
telerik:RadGrid
ID
=
"RadGrid1"
runat
=
"server"
Height
=
"100%"
PageSize
=
"50"
AllowPaging
=
"True"
AllowCustomPaging
=
"true"
>
<
MasterTableView
Width
=
"100%"
/>
<
PagerStyle
Visible
=
"false"
/>
<
ClientSettings
>
<
Scrolling
AllowScroll
=
"True"
UseStaticHeaders
=
"True"
/>
<
ClientEvents
OnGridCreated
=
"RadGrid1_OnGridCreated"
OnScroll
=
"RadGrid1_OnScroll"
/>
</
ClientSettings
>
</
telerik:RadGrid
>
</
div
>
</
form
>
</
body
>
</
html
>
Private
Sub
RadGrid1_ItemCommand(
ByVal
sender
As
Object
,
ByVal
e
As
Telerik.Web.UI.GridCommandEventArgs)
Handles
RadGrid1.ItemCommand
Select
e.CommandName
Case
"PageSizeIncrease"
RadGrid1.PageSize += e.CommandArgument
RadGrid1.Rebind()
End
Select
End
Sub
Private
Sub
RadGrid1_NeedDataSource(
ByVal
sender
As
Object
,
ByVal
e
As
Telerik.Web.UI.GridNeedDataSourceEventArgs)
Handles
RadGrid1.NeedDataSource
Dim
Table
As
New
DataTable
Table.Columns.Add(
New
DataColumn(
"Id"
,
GetType
(
Integer
)))
Dim
nStart
As
Integer
= (RadGrid1.CurrentPageIndex * RadGrid1.PageSize) + 1
Dim
nEnd
As
Integer
= (RadGrid1.CurrentPageIndex + 1) * RadGrid1.PageSize
For
i
As
Integer
= nStart
To
nEnd
Dim
Row
As
DataRow = Table.NewRow
Row(
"Id"
) = i
Table.Rows.Add(Row)
Next
RadGrid1.DataSource = Table
RadGrid1.VirtualItemCount =
"1000"
End
Sub
I'm having trouble with the ontextchanged event of the radmaskedtextbox. I enter my postal code into the mask and tab to the next field. It posts back and calls the ontextchanged event. However, the first time is posts back, the text value is blank "". If i enter the postal code a second time, the ontextchanged event picks up the value. It seems it needs a postback to actually change the value in the page, but the ontextchanged event runs before the value has been changed. Is there a workaround for this behaviour?<
telerik:RadMaskedTextBox
ID
=
"PostalCode"
runat
=
"server"
Text='<%#Bind("PostalCode")%>'
Mask="L#L #L#" OnTextChanged="PostalCode_OnTextChanged" AutoPostBack="true" Width="50" />
THIS WORKES:-
<
telerik:GridTemplateColumn
DataField
=
"vehicleModel"
HeaderText
=
"vehicleModel"
SortExpression
=
"vehicleModel"
UniqueName
=
"vehicleModel"
>
<
EditItemTemplate
>
<
telerik:RadComboBox
ID
=
"rcb_vehicleModel"
runat
=
"server"
Text='<%#DataBinder.Eval(Container.DataItem,"vehicleModel")%>' EnableLoadOnDemand="True" OnItemsRequested="rcb_vehicleModel_ItemsRequested" AutoPostBack="true">
</
telerik:RadComboBox
>
</
EditItemTemplate
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lbl_vehicleModel"
runat
=
"server"
Text='<%# Eval("vehicleModel") %>'></
asp:Label
>
</
ItemTemplate
>
<
HeaderStyle
Width
=
"6em"
/>
</
telerik:GridTemplateColumn
>
DOES NOT WORK:-
<
telerik:GridTemplateColumn
DataField
=
"vehicleModel"
HeaderText
=
"vehicleModel"
SortExpression
=
"vehicleModel"
UniqueName
=
"vehicleModel"
>
<
EditItemTemplate
>
<
telerik:RadComboBox
ID
=
"rcb_vehicleModel"
runat
=
"server"
DataSourceID
=
"sqlds_vehicleModel"
DataTextField
=
"vehicleModel"
DataValueField
=
"vehicleMake"
SelectedValue="<%# bind('vehicleModel') %>" AutoPostBack="True">
</
telerik:RadComboBox
>
</
EditItemTemplate
>
<
ItemTemplate
>
<
asp:Label
ID
=
"lbl_vehicleModel"
runat
=
"server"
Text='<%# Eval("vehicleModel") %>'></
asp:Label
>
</
ItemTemplate
>
<
HeaderStyle
Width
=
"6em"
/>
</
telerik:GridTemplateColumn
>
Protected Sub rcb_vehicleModel_ItemsRequested(ByVal sender As Object, ByVal e As RadComboBoxItemsRequestedEventArgs)
Dim editedItem As GridEditableItem = CType(CType(sender, RadComboBox).NamingContainer, GridEditableItem)
Dim ddl_make As RadComboBox = DirectCast(editedItem.FindControl("rcb_vehicleMake"), RadComboBox)
Dim ddl_model As RadComboBox = DirectCast(editedItem.FindControl("rcb_vehicleModel"), RadComboBox)
Dim ddl_vehicleEngine As RadComboBox = DirectCast(editedItem.FindControl("rcb_vehicleEngineSize"), RadComboBox)
Dim SQLstr As String
SQLstr = "SELECT DISTINCT vehicleModel FROM dbo.vehicleTypes WHERE (vehicleMake = '" & ddl_make.SelectedValue.ToString & "')"
' change the data source for ContactTitle with custom code here
sqlds_vehicleModel.SelectCommand = SQLstr
ddl_model.DataValueField = "vehicleModel"
ddl_model.DataTextField = "vehicleModel"
ddl_model.DataSource = sqlds_vehicleModel
ddl_model.DataBind() '********@ERROR HERE AS ABOVE: Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control
End Sub
I am using RadPanelbar as menu item in my app. The PanelBar is getting created dynamically from the database. I would like to differentiate parent and child menu items. The following is what I would like to do. Please let me how I can get this functionality.
1) User should not be able to click on the Parent item.
2) Add 2 different icons to Parent and Child menu items.
The following is my code.
Public Sub BindPanelBar(ByVal ds As DataSet)
RadPanelBar1.DataTextField = "description"
RadPanelBar1.DataNavigateUrlField = ""
RadPanelBar1.DataFieldID = "id"
RadPanelBar1.DataFieldParentID = "PARENT_ID"
RadPanelBar1.DataValueField = "Code"
RadPanelBar1.DataSource = ds
RadPanelBar1.DataBind()
End Sub
Protected Sub RadPanelBar1_ItemDataBound(ByVal sender As Object, ByVal e As RadPanelBarEventArgs) Handles RadPanelBar1.ItemDataBound
Dim row As DataRowView = DirectCast(e.Item.DataItem, DataRowView)
e.Item.Enabled = [Boolean].Parse(row("enable_status").ToString())
e.Item.Expanded = True
e.Item.ToolTip = e.Item.Text
End Sub
I am using Telerik.Web.UI.dll 2008.02.1001.20 version of Telerik ASP.NET AJAX and finding some strange issues with only on IE 8 browser on local machine where applicaiton is deployed on both Windows 7 and Windows 2008 machine. It does not happen if the site is accessed remotely from other machines in IE 8. The examples of issues are, with RadCombobox reducing the width during AJAX call or chaning the selection. Or RadGrid disappears during AJAX refresh or when RadToolTip is displayed in AJAX. The below are the different environments tried.
In above different senarios, some combination resolves some issues and other combination solves other issues. But I could not figure out any one setting which resolves all these Telerik issues. (BTW, I only get these issues with telerik controls when tried with IE 8 in local machines.) As said before everything works fine when the site is accessed remotely from other machines through IE 8.
Can you please provide any workaround to solve this issue? There is no option to upgrade the telerik control to later version for me due to project schedule. also as it is working fine remotely, it seems that there are some issues with IE 8 and telerik control only in local machine.
I truly appreciate your help to resolve this issue. thanks in advance!