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:RadMaskedTextBoxID="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 SubI 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!
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="frmViewUnitMaster.aspx.vb" Inherits="iTourism.WebForm1" %> <%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Web.UI" tagprefix="telerik" %> <!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></head><body> <form id="form1" runat="server" > <telerik:RadScriptManager ID="RadScriptManager1" runat="server"> </telerik:RadScriptManager> <div> <table style="width:100%;"> <tr> <td> </td> <td> <asp:Button ID="btnAdd" runat="server" Text="Add" Width="69px" /> <asp:Label ID="lblMessage" runat="server" Text="Label"></asp:Label> </td> <td> </td> </tr> <tr> <td> </td> <td> <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server"> <AjaxSettings> <telerik:AjaxSetting AjaxControlID="UMGrid"> <UpdatedControls> <telerik:AjaxUpdatedControl ControlID="UMGrid" /> </UpdatedControls> </telerik:AjaxSetting> </AjaxSettings> </telerik:RadAjaxManager> <telerik:RadGrid ID="UMGrid" runat="server" AutoGenerateColumns="False" GridLines="None" AllowFilteringByColumn="True" AllowSorting="True" AutoGenerateEditColumn="True" AllowPaging="True" Width="60%" ViewStateMode="Enabled" CellPadding="10" CellSpacing="10" onupdatecommand="UMGrid_UpdateCommand" > <ClientSettings> <Selecting AllowRowSelect="True" /> <Scrolling AllowScroll="True" /> <Selecting AllowRowSelect="True"></Selecting> </ClientSettings> <MasterTableView EditMode="EditForms" DataKeyNames="UnitCode"> <Columns> <telerik:GridBoundColumn DefaultInsertValue="" UniqueName="UnitCode" HeaderText="UnitCode" DataField="UnitCode" ReadOnly="True"> </telerik:GridBoundColumn> <telerik:GridBoundColumn DefaultInsertValue="" UniqueName="UnitDesc" HeaderText ="Unit Description" DataField="Description" > </telerik:GridBoundColumn> </Columns> <EditFormSettings EditFormType="AutoGenerated" > </EditFormSettings> </MasterTableView> </telerik:RadGrid> </td> <td> </td> </tr> </table> </div> </form></body></html>Imports SystemImports System.DataImports Telerik.Web.UIImports System.Data.SqlClient Public Class WebForm1 Inherits System.Web.UI.Page Dim objclsUnitMaster As New clsUnitMaster Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load UMGrid.AutoGenerateDeleteColumn = True UMGrid.AutoGenerateEditColumn = True UMGrid.DataSource = (objclsUnitMaster.GetUnitCodeList).Tables("UnitMaster") UMGrid.DataBind() End Sub Protected Sub btnAdd_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnAdd.Click Response.Redirect("frmUnitMaster.aspx") End Sub Private Sub UMGrid_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles UMGrid.ItemCommand If (e.CommandName = RadGrid.UpdateCommandName) Then Dim editedItem As GridEditableItem = CType(e.Item, GridEditableItem) Dim newValues As New Hashtable e.Item.OwnerTableView.ExtractValuesFromItem(newValues, editedItem) 'not getting the updated value lblMessage.Text = newValues("Description").ToString End If End Sub Private Sub UMGrid_NeedDataSource(ByVal source As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles UMGrid.NeedDataSource UMGrid.DataSource = (objclsUnitMaster.GetUnitCodeList).Tables("UnitMaster") UMGrid.DataBind() End Sub Public Sub UMGrid_UpdateCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles UMGrid.UpdateCommand ' Dim editedItem As GridEditableItem = CType(e.Item, GridEditableItem) 'Dim MyUserControl As UserControl = CType(e.Item.FindControl(GridEditFormItem.EditFormUserControlID), UserControl) Dim _UnitCode As Integer = 0 Dim _Description As String = "" Dim _Result As Long = 0 Dim _item As GridEditableItem _item = e.Item Try _UnitCode = Convert.ToInt32(DirectCast(_item("UnitCode").Controls(0), TextBox).Text) 'Unable to Get Updated Value using this also _Description = DirectCast(_item("Description").Controls(0), TextBox).Text _Result = objclsUnitMaster.UpdateUnitByCode(_UnitCode, _Description) If _Result = 0 Then lblMessage.Text = "Record Saved Successfully" Else lblMessage.Text = "Error While Saving Record" & " - " & _Result End If 'UMGrid.Rebind() Catch ex As Exception lblMessage.Text = ex.Message End Try End SubEnd Class <telerik:RadGrid ID="DataGrid" runat="server" ClientSettings-AllowColumnsReorder="true" ClientSettings-ReorderColumnsOnClient="true" AllowPaging="True" ShowFooter="True" HorizontalAlign="NotSet" PageSize="100" Width="100%" BorderWidth="0px" FilterItemStyle-HorizontalAlign="Center" HeaderStyle-HorizontalAlign="Center" FilterItemStyle-VerticalAlign="middle" AllowSorting="True" AllowFilteringByColumn="true"> <MasterTableView Dir="RTL" AutoGenerateColumns="False" AllowAutomaticDeletes="false" AllowAutomaticInserts="false" AllowAutomaticUpdates="false" AllowMultiColumnSorting="true" ClientDataKeyNames="BillID" DataKeyNames="BillID" CommandItemDisplay="Top"> <HeaderStyle HorizontalAlign="Center" /> <FilterItemStyle HorizontalAlign="Center" /> <NoRecordsTemplate>No Records Found.</NoRecordsTemplate> <CommandItemTemplate> <table id="headertable" runat="server" align="center"> <tr> <td> <asp:ImageButton ID="btnAdd" CommandName="Insert" ImageUrl="~/Styles/images/button_Client.jpg" runat="server" CausesValidation="false" Style="cursor: hand" AlternateText="Insert New Loan" /> </td> </tr> </table> </CommandItemTemplate> <Columns> <telerik:GridButtonColumn UniqueName="Edit" CommandName="Edit" ButtonType="ImageButton" ImageUrl="~/Styles/images/icon_edit.gif" Text="تعديل" HeaderText="تعديل"> <HeaderStyle Width="35px" HorizontalAlign="center" /> </telerik:GridButtonColumn> <telerik:GridButtonColumn UniqueName="Preview" CommandName="Preview" ButtonType="ImageButton" ImageUrl="~/Styles/images/icon_preview.gif" Text="فاتورة" HeaderText="فاتورة"> <HeaderStyle Width="35px" HorizontalAlign="center" /> </telerik:GridButtonColumn> <telerik:GridBoundColumn DataField="BillID" Visible="False" HeaderText="BillID" ReadOnly="True" SortExpression="BillID" UniqueName="BillID" /> <telerik:GridBoundColumn DataField="BillNumber" Visible="true" HeaderText="الرقم"ReadOnly="True" SortExpression="BillNumber" UniqueName="BillNumber" /> <telerik:GridBoundColumn DataField="BillFile" Visible="true" HeaderText="الملف" ReadOnly="True"SortExpression="BillFile" UniqueName="BillFile" /> <telerik:GridBoundColumn DataField="ClientName" Visible="true" HeaderText="اسم الزبون"ReadOnly="True" SortExpression="ClientName" UniqueName="ClientName" /> <telerik:GridBoundColumn DataField="ClientCode" Visible="true" HeaderText="رمز الزبون"ReadOnly="True" SortExpression="ClientCode" UniqueName="ClientCode" /> <telerik:GridBoundColumn DataField="Weight" Visible="true" HeaderText="الوزن كلغ"ReadOnly="True" SortExpression="Weight" UniqueName="Weight" /> <telerik:GridBoundColumn DataField="BillValue" Visible="true" HeaderText="القيمة"ReadOnly="True" SortExpression="BillValue" UniqueName="BillValue" /> <telerik:GridBoundColumn DataField="ClosingDate" Visible="true" HeaderText="تاريخ إغلاق الفاتورة" ReadOnly="True" SortExpression="ClosingDate" UniqueName="ClosingDate" /> <telerik:GridBoundColumn DataField="ReleaseDate" Visible="true" HeaderText="السنة" ReadOnly="True" SortExpression="ReleaseDate" UniqueName="ReleaseDate" /> </Columns> <ExpandCollapseColumn ButtonType="ImageButton" UniqueName="ExpandColumn" Visible="False"> <HeaderStyle Width="19px" /> </ExpandCollapseColumn> <PagerStyle Mode="NextPrevNumericAndAdvanced" PageButtonCount="20" /> </MasterTableView> <GroupPanel> <PanelItemsStyle CellSpacing="2" /> </GroupPanel> <ClientSettings AllowColumnsReorder="True" EnableRowHoverStyle="true"> <Selecting AllowRowSelect="true" /> </ClientSettings> </telerik:RadGrid>Private Sub BuildDataGrid(ByVal view As Views) Try Dim addColumn As Action(Of GridColumn) = Sub(column) BottomSection(Of TMGrid)("dgView").MasterTableView.Columns.Add(column) Dim addToGrouping As Action(Of GridColumn) = Sub(column) BottomSection(Of TMGrid)("dgView").MasterTableView.GroupByExpressions.Add( New GridGroupByExpression(column) ) End Sub With BottomSection(Of TMGrid)("dgView") .MasterTableView.Columns.Clear() .MasterTableView.GroupByExpressions.Clear() Select Case view Case Views.Daily TMGrid.AddBoundColumn( addColumn, Function() "tl_date", Function() "Date", Function() False, Function() "{0:MMMM d}", Sub(column) Dim grouping As New GridGroupByExpression() Dim selectDate As New GridGroupByField() selectDate.FieldName = "tl_date" selectDate.FieldAlias = "tl_date" selectDate.FormatString = TMGrid.SHORT_DATE_FORMAT selectDate.HeaderText = "DATE" selectDate.HeaderValueSeparator = ": " Dim selectTotalHours As New GridGroupByField() selectTotalHours.FieldName = "te_hours" selectTotalHours.FieldAlias = "te_hours" selectTotalHours.HeaderText = "TOTAL HOURS" selectTotalHours.Aggregate = GridAggregateFunction.Sum selectTotalHours.FormatString = TMGrid.HOURS selectTotalHours.HeaderValueSeparator = ": " Dim groupByDate As New GridGroupByField() groupByDate.FieldName = "tl_date" groupByDate.FieldAlias = "tl_date" grouping.SelectFields.Add(selectDate) grouping.SelectFields.Add(selectTotalHours) grouping.GroupByFields.Add(groupByDate) 'grouping.Expression = "tl_date [Date], Sum(te_hours) TotalHours [Total Hours] Group By tl_date" BottomSection(Of TMGrid)("dgView").MasterTableView.GroupByExpressions.Add(grouping) End Sub ) TMGrid.AddBoundColumn( addColumn, Function() "tc_name", Function() "ACTIVITY", AddressOf RequireSubactivity, Nothing, addToGrouping ) TMGrid.AddBoundColumn( addColumn, Function() "tsc_name", Function() "SUBACTIVITY" ) TMGrid.AddBoundColumn( addColumn, Function() "te_desc", Function() "DESCRIPTION" ) TMGrid.AddBoundColumn( addColumn, Function() "te_hours", Function() "HOURS", Function() True, Function() "<a href='{0}'>{0:#0.00}</a>", Sub(column) column.ItemStyle.HorizontalAlign = HorizontalAlign.Right column.HeaderStyle.HorizontalAlign = HorizontalAlign.Right column.FooterStyle.HorizontalAlign = HorizontalAlign.Right column.Aggregate = GridAggregateFunction.Sum column.FooterAggregateFormatString = "Total: {0:#0.00}" End Sub ) Case Views.Monthly TMGrid.AddBoundColumn( addColumn, Function() "tl_monthname", Function() "Month", Function() False, Nothing, addToGrouping ) TMGrid.AddBoundColumn( addColumn, Function() "tc_name", Function() "ACTIVITY", AddressOf RequireSubactivity, Nothing, addToGrouping ) TMGrid.AddBoundColumn( addColumn, Function() "tsc_name", Function() "SUBACTIVITY" ) TMGrid.AddBoundColumn( addColumn, Function() "te_desc", Function() "DESCRIPTION" ) If (Convert.ToInt32(ViewState("ReportingMode")) = TMTERMSOptions.TMTERMSReportingModes.Daily) Then TMGrid.AddBoundColumn( addColumn, Function() "te_hours", Function() "HOURS", Function() True, Function() "{0:#0.00}", Sub(column) column.ItemStyle.HorizontalAlign = HorizontalAlign.Right column.HeaderStyle.HorizontalAlign = HorizontalAlign.Right column.FooterStyle.HorizontalAlign = HorizontalAlign.Right column.Aggregate = GridAggregateFunction.Sum column.FooterAggregateFormatString = "Total: {0:#0.00}" End Sub ) Else TMGrid.AddBoundColumn( addColumn, Function() "te_hours", Function() "HOURS", Function() True, Function() "<a href='{0}'>{0:#0.00}</a>", Sub(column) column.ItemStyle.HorizontalAlign = HorizontalAlign.Right column.HeaderStyle.HorizontalAlign = HorizontalAlign.Right column.FooterStyle.HorizontalAlign = HorizontalAlign.Right column.Aggregate = GridAggregateFunction.Sum column.FooterAggregateFormatString = "Total: {0:#0.00}" End Sub ) End If TMGrid.AddBoundColumn( addColumn, Function() "certified_message", Function() "CERTIFICATION" ) TMGrid.AddBoundColumn( addColumn, Function() "approved_message", Function() "APPROVAL" ) TMGrid.AddBoundColumn( addColumn, Function() "te_approved_hours", Function() "APPROVED HOURS", Function() "{0:#,##0.00}" ) Case Views.Annual TMGrid.AddBoundColumn( addColumn, Function() "tl_year", Function() "YEAR", Function() False, Nothing, addToGrouping ) TMGrid.AddBoundColumn( addColumn, Function() "tc_name", Function() "YEAR / ACTIVITY", AddressOf RequireSubactivity, Nothing, addToGrouping ) TMGrid.AddBoundColumn( addColumn, Function() "tsc_name", Function() "YEAR / ACTIVITY / SUBACTIVITY" ) TMGrid.AddBoundColumn( addColumn, Function() "te_hours", Function() "HOURS", Function() "{0:#,##0.00}" ) End Select End With Catch ex As Exception Throw New Exception("BuildDataGrid procedure failed", ex) End TryEnd Sub