Telerik Forums
UI for ASP.NET AJAX Forum
2 answers
104 views
Hello -

I have a RadGrid that I am using to present a custom reporting solution for our clients (they choose columns, column order, format, etc. then results are displayed in a RadGrid).

Everything is working great, except that when someone wants to save the file as a CSV, a "byte order marker" (BOM) appears at the beginning of the file.  This marker does not appear in the ExportOutput returned from GridExportingArgs that is fired in the OnGridExporting event.  The BOM is causing our customers to have to edit the file before they can run it through their automated systems.

My question is: How can I prevent the BOM from being saved into the CSV file?  Is this possible?

Thanks in advance,
-Brendan
Brendan Casey
Top achievements
Rank 1
 answered on 04 Jan 2011
4 answers
226 views
How do I change the tab order of editable fields in a grid that has all fields open for editing (see attached image)?  Specifically, how do I change from horizontal tabbing to vertical tabbing (see red numbers in attached image)?  The text boxes are RadNumeric text boxes?
WCRA Dev
Top achievements
Rank 1
 answered on 04 Jan 2011
1 answer
83 views
Hi everyone,

I am using the scheduler in timeline view. One thing I have noticed and which I am having difficulty in trying to find a solution for is how to ensure the current block of hours displayed in the timeline view get reset when the scheduler is refreshed from an ajax callback. I should clarify that the intention of this callback is to reset the scheduler with a new date, but the start time for the hours displayed to always start at 8:00 a.m. Right now, I have no problems refreshing the scheduler to display a new date. What I have observed however, is that if I have navigated part way through the block of hours for a given selected date (say starting from 8 a.m. to 8 p.m. and I currently see 1pm to 4pm), when I refresh the entire scheduler instance with a callback, the new date is displayed, but the selected block of hours does not reset to 8 a.m. See attached visuals for reference.

How can I ensure that when the scheduler is completely refreshed (rebind()) with new resources and appointments that the selected block of hours restarts at the initial start time? On the callback I try to reset the start time using:

DispatchScheduler.TimelineView.StartTime = TimeSpan.Parse("08:00:00");

But this does not seem to work. The last block of hours to be displayed in the timeline view remain.

Any feedback would be appreciated.

Cheers,

Derek


Peter
Telerik team
 answered on 04 Jan 2011
1 answer
140 views
Hey there,

I'm essentially attempting to use the RadUpload control as a means for a user to select a text file which I will then read and render on the screen.  The behavior I have now is functional, but not ideal, as the user is required to click an additional button in order to force a postback so the selected file is shown on the screen.

The behavior I would like to create is as follows:

1.  User clicks "Select."
2.  User selects a file and clicks "Open."
3.  Upon clicking "Open," a postback occurs and the selected file is read and rendered to the screen.

Is there a way to do this?  Or, is there another control that I should look into to accomplish this?  Ultimately, the file-browser functionality of the Upload control is the most important piece of this for me.

Thanks!

Chris
Cori
Top achievements
Rank 2
 answered on 04 Jan 2011
1 answer
46 views
I might just have a case of Holiday Hangover, but I cannot figure out how to add the "Confirm postback with radconfirm" button found here to a ListView using the Basic filtering found here. The ListView uses the "Telerik.ListViewExamplesVBNET.Paging.IntegratedPaging" namespace and the RadConfirm button uses the "Telerik.Web.Examples.Window.BrowserDialogBoxes" namespace.

Can someone help me get out of this holiday fog?
Georgi Tunev
Telerik team
 answered on 04 Jan 2011
3 answers
77 views
I am writing an application for a client which will use as its data files she prepares from another system.  I'd like to automate the process as much as possible, putting the responsibility of cleaning the data back on her.  Does it make any sense to use a file upload to build the table(s) if the data in the file(s) being uploaded needs to be edited?  Is the right way to handle the file creation is to upload (and process) the file(s), splitting it into good data and data needing additional massage to be added.

thanks
Marianne
Cori
Top achievements
Rank 2
 answered on 04 Jan 2011
3 answers
174 views
Mary Christmas every body. Help me.
I have AJAX app. with a masterpage in here I have a Radajaxmanager, a default.aspx in this I load different usercontrols dynamic. In one of these usercontrols I have a grid with a list of data, where it is possible to open a radwindow. In this window user can do some update of data and when user close this window I want to refresh the grid. I have readed all possible information about the AJAX wai to do this, but nothing happent. Can anyone help me?

Here is the code.

user control who hold the grid:

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="AktivitetsListe.ascx.vb" Inherits="emtepv3_5.WEB.UC.AktivitetsListe" %>
<telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
<script type="text/javascript">
    function myUserControlClickHandler() {
        $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequest("content");
    }
    function ShowEditForm(id, rowIndex, tp) {
        var grid = $find("<%= RadGrid_AKtivitetsListe.ClientID %>");
  
        var rowControl = grid.get_masterTableView().get_dataItems()[rowIndex].get_element();
        grid.get_masterTableView().selectItem(rowControl, true);
  
       if (tp == "copy")
       {
           WindowOpen(1000, 600, "../UI/AktDetaljer/AktivitetsCopy.aspx?AktID=" + id, "eMTEP-DK - Aktivitetsdetaljer");
           return false;
        }
           else 
           {
               WindowOpen(1000, 600, "../UI/AktDetaljer/AktivitetsDetaljer.aspx?AktID=" + id, "eMTEP-DK - Aktivitetsdetaljer");
               return false;
           }
    }
    function ShowInsertForm() {
        WindowOpen(1000, 600, "../UI/AktDetaljer/AktivitetsDetaljer.aspx?AktID=0", "eMTEP-DK - Aktivitetsdetaljer");  
        return false;
    }
    function refreshGrid(arg) {
        if (!arg) {
            $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequest("Rebind");
        }
        else {
            $find("<%= RadAjaxManager.GetCurrent(Page).ClientID %>").ajaxRequest("RebindAndNavigate");
        }
    }
    function RowDblClick(sender, eventArgs) {
        WindowOpen(1000, 600, "../UI/AktDetaljer/AktivitetsDetaljer.aspx?AktID=" + eventArgs.getDataKeyValue("AktivitetsID"), "eMTEP-DK - Aktivitetsdetaljer");
    }
    function WindowOpen(Width, Height, Url, HeaderText) {
        var oWin = window.radopen(Url, HeaderText);
        oWin.set_title(HeaderText);  
        oWin.setSize(Width, Height);
        oWin.MoveTo(10, 100);
        oWin.set_behaviors(Telerik.Web.UI.WindowBehaviors.Close);
        oWin.set_visibleStatusbar(false);
       // oWin.add_close(OnClientClose);      
       return false;
   }
  // function OnClientClose(sender, eventArgs) {
   //    $find("<%=RadGrid_AKtivitetsListe.ClientID %>").get_masterTableView().rebind();
  // }
  
   </script>
</telerik:RadScriptBlock>
<telerik:RadAjaxManagerProxy ID="RadAjaxManagerProxy1" runat="server">
   <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadAjaxManagerProxy1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid_AKtivitetsListe" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="RadGrid_AKtivitetsListe">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid_AKtivitetsListe" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
</telerik:RadAjaxManagerProxy
  
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" Runat="server" 
    Skin="Office2007" BackgroundPosition="Center">
</telerik:RadAjaxLoadingPanel>
<br />
<telerik:RadGrid ID="RadGrid_AKtivitetsListe" runat="server" Skin="Office2007" 
    AutoGenerateColumns="False" GridLines="None" Height="600px">
<MasterTableView DataKeyNames="AktivitetsID" ClientDataKeyNames="AktivitetsID" CommandItemDisplay="Top">
<CommandItemSettings ExportToPdfText="Export to Pdf"></CommandItemSettings>
    <Columns>
       <telerik:GridImageColumn DataType="System.String" 
            DataImageUrlFields="AktivitetsStatusUrl"  DataImageUrlFormatString="~/images/{0}" 
        ImageAlign="Middle" UniqueName="AktStatusCol"
           <HeaderStyle Width="40px" />
        </telerik:GridImageColumn>
        <telerik:GridBoundColumn DataField="AktivitetsPeriode" UniqueName="AktivitetsPeriode">
        </telerik:GridBoundColumn>
         <telerik:GridBoundColumn DataField="AktivitetsNavn" UniqueName="AktivitetsNavn">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="AktivitetsSted" UniqueName="AktivitetsSted">
        </telerik:GridBoundColumn>
        <telerik:GridBoundColumn DataField="AktivitesRegNr" UniqueName="AktivitesRegNr">
        </telerik:GridBoundColumn>
         <telerik:GridTemplateColumn UniqueName="EditCol">
            <ItemTemplate>
               <asp:ImageButton ID="ImgEdit" runat="server" />  
            </ItemTemplate
        </telerik:GridTemplateColumn>
         <telerik:GridTemplateColumn UniqueName="CopyCol">
            <ItemTemplate>
               <asp:ImageButton ID="ImgCopy" runat="server" />
            </ItemTemplate
        </telerik:GridTemplateColumn>
        <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" 
            Text="Delete" UniqueName="DeleteCol">
        </telerik:GridButtonColumn>
      </Columns>
      <CommandItemTemplate>
                          <telerik:RadButton ID="RadButtonAddNew" runat="server" Skin="Office2007"></telerik:RadButton>    
      </CommandItemTemplate>
</MasterTableView>
            <ClientSettings>
                <Selecting AllowRowSelect="true" />
                <ClientEvents OnRowDblClick="RowDblClick" />
                <Scrolling AllowScroll="True" UseStaticHeaders="True" />
            </ClientSettings>
  
<HeaderContextMenu EnableImageSprites="True" CssClass="GridContextMenu GridContextMenu_Office2007"></HeaderContextMenu>
</telerik:RadGrid>
  
 <telerik:RadWindowManager ID="RadWindowManager1" runat="server" EnableShadow="true">
            <Windows>
                <telerik:RadWindow ID="AktDetaljerWindow" runat="server" Title="eMTEP-DK" Height="320px"
                    Width="510px" Left="350px" ReloadOnShow="true" ShowContentDuringLoad="false"
                    Modal="true" />
            </Windows>
        </telerik:RadWindowManager>

The codebehind:
Imports emtepv3_CodeTier.BL
Imports Telerik.Web.UI
Imports emtepv3_5.WEB.CL
Namespace UC
    Public Class AktivitetsListe
        Inherits clsHandle
        Private DateFra As DateTime
        Private DateTil As DateTime
        Private SObj As String
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
            Dim manager As RadAjaxManager = RadAjaxManager.GetCurrent(Page)
            AddHandler manager.AjaxRequest, AddressOf manager_AjaxRequest
        End Sub
        Protected Sub manager_AjaxRequest(ByVal sender As Object, ByVal e As Telerik.Web.UI.AjaxRequestEventArgs)
            'handle the manager AjaxRequest event here
            RadGrid_AKtivitetsListe.Rebind()
        End Sub
        Protected Sub Page_OnPassData(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.OnPassData
            'siden Ã¥bnes og data overføres
            'DateFra = 
            FraDato = Me.DatoFra
            'DateTil =
            TilDato = Me.DatoTil
            ' SObj =
            SoegTxt = Me.SearchObj
        End Sub
        Protected Sub RadGrid_AKtivitetsListe_NeedDataSource(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridNeedDataSourceEventArgs) Handles RadGrid_AKtivitetsListe.NeedDataSource
            'grid fyldes med data
            Dim gd As New GrundData
            gd.GrundDataDatoFra = FraDato
            gd.GrundDataDatoTil = TilDato
  
            MsgBox(FraDato)
  
            Dim br As New Bruger
            br.BrugerFiinAdresse = br.LogonBruger
            br.BrugerByFiinAdress()
  
            Dim akt As New Aktiviteter
            If SoegTxt = "ALL" Then
                akt.AktiviteterSelectByBrugerID(br, gd)
            Else
                Dim st As New SearchText
                st.SoegeTekst = SoegTxt
                akt.AktiviteterSelectByBrugerObjekter(gd, st, br)
            End If
            Dim culist As List(Of Aktiviteter) = akt.AktivitetsCollection
  
            StandardTexter.LoadGridTexter(RadGrid_AKtivitetsListe)
  
            RadGrid_AKtivitetsListe.DataSource = culist
        End Sub
        Protected Sub RadGrid1_ItemCreated(ByVal sender As Object, ByVal e As GridItemEventArgs) Handles RadGrid_AKtivitetsListe.ItemCreated
            'aktioner nÃ¥r grid dannes
            If TypeOf e.Item Is GridHeaderItem Then
                Dim header As GridHeaderItem = CType(e.Item, GridHeaderItem)
                header("AktivitetsPeriode").Text = StandardTexter.SetFaellesTexter("Periode")
                header("AktivitetsNavn").Text = StandardTexter.SetFaellesTexter("Navn")
                header("AktivitetsSted").Text = StandardTexter.SetFaellesTexter("Sted")
                header("AktivitesRegNr").Text = StandardTexter.SetFaellesTexter("RegNr")
            End If
            'afhængig af hvilket menupunkt siden kaldes fra vises forskellige kontroller i gridet
            If TypeOf e.Item Is GridDataItem Then
                Dim ImgEd As ImageButton = DirectCast(e.Item.FindControl("ImgEdit"), ImageButton)
                ImgEd.ImageUrl = "~/images/Edit.gif"
                ImgEd.Attributes("onclick") = [String].Format("return ShowEditForm('{0}','{1}', 'Akt');", e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("AktivitetsID"), e.Item.ItemIndex)
                Dim ImgCopy As ImageButton = DirectCast(e.Item.FindControl("ImgCopy"), ImageButton)
                ImgCopy.ImageUrl = "~/images/Copy.gif"
                ImgCopy.Attributes("onclick") = [String].Format("return ShowEditForm('{0}','{1}', 'copy');", e.Item.OwnerTableView.DataKeyValues(e.Item.ItemIndex)("AktivitetsID"), e.Item.ItemIndex)
            End If
  
            If TypeOf e.Item Is GridCommandItem Then
                'tilføj ny post knap fÃ¥r funktioner
                Dim RadImgBtn As RadButton = DirectCast(e.Item.FindControl("RadButtonAddNew"), RadButton)
                RadImgBtn.Text = StandardTexter.SetGridHeaderText("RadGrid_AddNewText")
                RadImgBtn.Icon.PrimaryIconUrl = "~/images/AddRecord.gif"
                RadImgBtn.Attributes("onclick") = [String].Format("return ShowInsertForm();")
            End If
        End Sub
        Private Property FraDato() As DateTime
            Get
                Return CDate(ViewState("FraDato"))
            End Get
            Set(ByVal value As DateTime)
                ViewState("FraDato") = value
            End Set
        End Property
        Private Property TilDato() As DateTime
            Get
                Return CDate(ViewState("TilDato"))
            End Get
            Set(ByVal value As DateTime)
                ViewState("TilDato") = value
            End Set
        End Property
        Private Property SoegTxt() As String
            Get
                Return CStr(ViewState("SoegTxt"))
            End Get
            Set(ByVal value As String)
                ViewState("SoegTxt") = value
            End Set
        End Property
    End Class
End Namespace

The aspx in the radwindow:

<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="AktivitetsDetaljer.aspx.vb" Inherits="emtepv3_5.WEB.UI.AktivitetsDetaljer" %>
  
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  
<head runat="server">
    <title></title>
    <link href="../../emtepStyle.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
    <div align="right">
        <asp:ImageButton ID="ImgBtnClose" runat="server" ImageUrl="~/images/Stop.gif" />
    </div>
   <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
    <script type="text/javascript">
            function onTabSelecting(sender, args) {
            if (args.get_tab().get_pageViewID()) {
                args.get_tab().set_postBack(false);
            }
        }
        function CloseAndRebind(args) {
           GetRadWindow().BrowserWindow.refreshGrid(args);
            GetRadWindow().close();
        }
  
        function GetRadWindow() {
            var oWindow = null;
            if (window.radWindow) oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog
            else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow; //IE (and Moz as well)
  
            return oWindow;
        }
        </script>
        </telerik:RadScriptBlock>
        <telerik:RadScriptManager ID="RadScriptManager1" Runat="server">
        </telerik:RadScriptManager>
          
        <telerik:RadFormDecorator ID="RadFormDecorator1" Runat="server" 
        Skin="Office2007" />
          
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
           <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadTabStripAktivitet">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadTabStripAktivitet" />
                        <telerik:AjaxUpdatedControl ControlID="RadMultiPageAktivitet" LoadingPanelID="LoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
                <telerik:AjaxSetting AjaxControlID="RadMultiPageAktivitet">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadMultiPageAktivitet" LoadingPanelID="LoadingPanel1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings
        </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" Runat="server" 
        Skin="Office2007" BackgroundPosition="Center">
    </telerik:RadAjaxLoadingPanel>
    <telerik:RadTabStrip ID="RadTabStripAktivitet" runat="server" Skin="Office2007" OnClientTabSelecting="onTabSelecting" 
        MultiPageID="RadMultiPageAktivitet" SelectedIndex="0">
    </telerik:RadTabStrip>
    <telerik:RadMultiPage ID="RadMultiPageAktivitet" Runat="server" SelectedIndex="0" CssClass="AktDetaljeTabSiden">
    </telerik:RadMultiPage>
    </form>
</body>
</html>
The code to this page:
Imports emtepv3_5.WEB.CL
Imports emtepv3_CodeTier.BL
Imports Telerik.Web.UI
Namespace UI
    Public Class AktivitetsDetaljer
        Inherits System.Web.UI.Page
        Dim IsNewPageView As Boolean = False
        Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
            If Not Me.Page.IsPostBack Then
                BindRadTab()
                If CInt(Request("AktID")) <> 0 Then
                    Select Case StandardTexter.BrugerLanguage
                        Case "DA"
                            AddPageView(RadTabStripAktivitet.FindTabByText("Grunddata"))
                        Case "EN"
                            AddPageView(RadTabStripAktivitet.FindTabByText("Maindata"))
                    End Select
                Else
                    Select Case StandardTexter.BrugerLanguage
                        Case "DA"
                            AddPageView(RadTabStripAktivitet.FindTabByText("Opret ny aktivitet"))
                        Case "EN"
                            AddPageView(RadTabStripAktivitet.FindTabByText("Add new activity"))
                    End Select
                End If
            End If
        End Sub
        Protected Sub BindRadTab()
            Dim St As New SearchText
            If CInt(Request("AktID")) = 0 Then
                St.SoegeTekst = 0
            Else
                Dim gd As New GrundData
                gd.GrundDataID = Request("AktID")
                gd.GrundDataById()
                Dim Sgtxt As String = gd.GrundDataAktArt & ","
                Sgtxt = Sgtxt & "1"
                St.SoegeTekst = Sgtxt
            End If
  
            Dim akttab As New AktivitetsDetaljeTab
            akttab.AktDetaljeTabGetByAktType(St)
            Dim cuList As List(Of AktivitetsDetaljeTab) = akttab.AktDetaljeTabCollection
  
            RadTabStripAktivitet.DataFieldID = "AktDetaljeTabID"
            Select Case StandardTexter.BrugerLanguage
                Case "DA"
                    RadTabStripAktivitet.DataTextField = "AktDetaljeTabTekstDA"
                Case "EN"
                    RadTabStripAktivitet.DataTextField = "AktDetaljeTabTekstEN"
            End Select
  
            RadTabStripAktivitet.DataSource = cuList
            RadTabStripAktivitet.DataBind()
  
        End Sub
        Private Sub AddPageView(ByVal tab As RadTab)
            Dim pageView As RadPageView = New RadPageView
            pageView.ID = tab.Text
            RadMultiPageAktivitet.PageViews.Add(pageView)
            tab.PageViewID = pageView.ID
        End Sub
  
        Protected Sub RadTabStrip1_TabClick(ByVal sender As Object, ByVal e As RadTabStripEventArgs) Handles RadTabStripAktivitet.TabClick
            AddPageView(e.Tab)
            e.Tab.PageView.Selected = True
        End Sub
        Protected Sub RadMultiPage1_PageViewCreated(ByVal sender As Object, ByVal e As Telerik.Web.UI.RadMultiPageEventArgs) Handles RadMultiPageAktivitet.PageViewCreated
            Dim adt As New AktivitetsDetaljeTab
            adt.AktDetaljeTabTekstDA = e.PageView.ID
            adt.AktDetaljeTabGetPageName()
  
            Dim userControlName As String = "~/UC/AktFaner/" + adt.AktDetaljeTabPage + ".ascx"
            Dim userControl As Control = Page.LoadControl(userControlName)
            userControl.ID = e.PageView.ID & "_Grunddata"
            e.PageView.Controls.Add(userControl)
        End Sub
        Protected Sub ImgBtnClose_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImgBtnClose.Click
            ClientScript.RegisterStartupScript(Page.[GetType](), "mykey", "CloseAndRebind();", True)
        End Sub
    End Class
End Namespace
Georgi Tunev
Telerik team
 answered on 04 Jan 2011
3 answers
87 views
Hi,
I am playing around with the MinutesPerRow and TimeLabelRowSpan properties. The default settings are 30 and 2 resp.

In day and weekview, the lines separating the rows are rendered thicker every 2 rows.

If I set TimeLabelRowSpan to 3, this looks very weird/confusing, since the lines separating the time labels do not connect to the thicker rendered row separating lines.

Can I control the events/count in which the thicker row separator lines in the scheduler are rendered?

Or could this be a bug? I would expect the label separating lines to connect to the thicker rendered row separating lines so if it is hardcoded that every 2 row separating lines a line is rendered thicker this cannot be accomplished.
A solution would be to render every TimeLabelRowSpan-nd row separating line thicker.

regards,
Johan


Can I change the subject of a topic?
Better would be:

"What property controls the rendering logic of the thicker row separating lines in dayview/weekview?"
Peter
Telerik team
 answered on 04 Jan 2011
1 answer
77 views
Hello,

Beginner question:
I have a RadToolBox:
<telerik:RadTextBox ID="RadTextBox1" Runat="server" name="nameTest"/>


And I have an ASP button that run this code:
        Dim a As String = Request.Form("nameTest")
        Dim b As String = Request.Form("RadTextBox1")

Both a and b always remain null.

Questions
- How do I get postback values from Rad components ?
- How do I get postback values from Rad components when they are in user control ?


Thank you
Tsvetina
Telerik team
 answered on 04 Jan 2011
2 answers
119 views

I have a page that when auto or partial post back happens, focus is set to the address bar rather than the next control. The interesting thing is that when I put an alert in my RadScriptBlock, after the OK is clicked, focus goes to the correct control -or- if I put in an invalid location, focus is returned to the ExpLocation control & when a correct location is input the second time, the tab order/focus command works correctly (see code below).

That has this up top

<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
   
<AjaxSettings>
       
<telerik:AjaxSetting AjaxControlID="RadAjaxPanel1">
           
<UpdatedControls>
               
<telerik:AjaxUpdatedControl ControlID="RadAjaxPanel1" LoadingPanelID="RadAjaxLoadingPanel1" />
           
</UpdatedControls>
       
</telerik:AjaxSetting>
       
<telerik:AjaxSetting EventName="OnTextChanged" AjaxControlID="RadNumericTextBox_GLm">
           
<UpdatedControls>
               
<telerik:AjaxUpdatedControl ControlID="RadNumericTextBox_GLm" LoadingPanelID="RadAjaxLoadingPanel1" />
               
<telerik:AjaxUpdatedControl ControlID="lblGlCodeErrorMessage" LoadingPanelID="RadAjaxLoadingPanel1" />
           
</UpdatedControls>
       
</telerik:AjaxSetting>
       
<telerik:AjaxSetting EventName="OnTextChanged" AjaxControlID="RadNumericTextBox_ExpLocation">
           
<UpdatedControls>
               
<telerik:AjaxUpdatedControl ControlID="lblGlCodeErrorMessage" LoadingPanelID="RadAjaxLoadingPanel1" />
               
<telerik:AjaxUpdatedControl ControlID="RadNumericTextBox_ExpLocation" LoadingPanelID="RadAjaxLoadingPanel1" />
           
</UpdatedControls>
       
</telerik:AjaxSetting>
   
</AjaxSettings>
</telerik:RadAjaxManager>

That has this control..

<telerik:RadNumericTextBox ID="RadNumericTextBox_ExpLocation" runat="server" Width="20px" AutoPostBack="true"
MaxLength="3" NumberFormat-AllowRounding="False" Type="Number" NumberFormat-KeepTrailingZerosOnFocus="True"
IncrementSettings-InterceptMouseWheel="false" OnTextChanged="LocationCheck_OnTextChanged" TabIndex="101">
<NumberFormat DecimalDigits="0" GroupSeparator="" AllowRounding="false" KeepNotRoundedValue="false" />

Code behind...

 protected void LocationCheck_OnTextChanged(object sender, System.EventArgs e)
{
   
var cmdText = "SELECT LMLOC FROM DBMOTO..XALOCNP WHERE  " +
           
" LMLOC = @ExpLocation ";
       
using (var conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MAINConnectionString"].ToString()))
       
using (var cmd = new SqlCommand(cmdText, conn))
       
{
            cmd
.Parameters.Add(new SqlParameter("@ExpLocation", RadNumericTextBox_ExpLocation.Text));
            conn
.Open();
           
SqlDataReader dr = cmd.ExecuteReader();
           
if (dr.HasRows)
           
{
               
Session["ValidGL"] = false;
                lblGlCodeErrorMessage
.Visible = false;
                lblGlCodeErrorMessage
.Text = "Good Location";
                btnAddItem
.Enabled = false;
                btnDone
.Enabled = false;
               
RadNumericTextBox_GLm.Focus();
           
}
           
else
           
{
                lblGlCodeErrorMessage
.Visible = true;
                lblGlCodeErrorMessage
.Text = "Invalid/Inactive Location";
                btnAddItem
.Enabled = false;
                btnDone
.Enabled = false;
               
RadNumericTextBox_ExpLocation.Focus();
           
}
       
}
}

Maria Ilieva
Telerik team
 answered on 04 Jan 2011
Narrow your results
Selected tags
Tags
+? more
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Top users last month
Will
Top achievements
Rank 2
Iron
Motti
Top achievements
Rank 1
Iron
Hester
Top achievements
Rank 1
Iron
Bob
Top achievements
Rank 3
Iron
Iron
Veteran
Thomas
Top achievements
Rank 2
Iron
Want to show your ninja superpower to fellow developers?
Want to show your ninja superpower to fellow developers?