hello.
can you show us a sample page?
Sure - thanks for replying!
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<atlas:ScriptManager ID="scriptmanager" EnablePartialRendering=true runat="server" />
    <asp:ObjectDataSource ID="ODS" runat="server"
        OldValuesParameterFormatString="{0}" SelectMethod="GetByUser"
        TypeName="ds_ttTableAdapters.ds_ttTableAdapter" DeleteMethod="DeleteQuery" UpdateMethod="Update1">
        <SelectParameters>
            <asp:Parameter Name="usr" Type="Int32" />
        </SelectParameters>
        <UpdateParameters>
        </UpdateParameters>
    </asp:ObjectDataSource>
    <asp:SqlDataSource ID="sds_clients" runat="server" ConnectionString="<%$ ConnectionStrings:blCS %>"
        SelectCommand="SELECT [client_num], [client_id] FROM [clients]">
    </asp:SqlDataSource
<asp:HiddenField ID="userID" runat="server" />
<asp:Panel ID="pnl" runat=server>
<atlas:UpdatePanel ID="panel3" runat="server" Mode=Always EnableViewState=true  >
<ContentTemplate>
<center
        Date:   
        <asp:TextBox ID="txt_date"  runat="server" AutoPostBack=true TabIndex="1" Width="50px" />
   
        Client:   
        <asp:TextBox ID="txt_client" runat=server AutoPostBack=true TabIndex="2" Columns="10"></asp:TextBox>
        <atlas:AutoCompleteExtender ID="txt_client_autoex"  runat=server>
             <atlas:AutoCompleteProperties  MinimumPrefixLength="1" Enabled="true" ServiceMethod="client_lkp" ServicePath="client_lookup.asmx" TargetControlID="txt_client" />
        </atlas:AutoCompleteExtender
That's the top piece of the page in question. I have the following code:
    Protected Sub txt_date_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txt_date.TextChanged
        Dim txt_excdate As TextBox
        default_excdate = txt_date.Text
        txt_excdate = gv_tktentry.FooterRow.FindControl("txt_excdate")
        txt_excdate.Text = default_excdate
        txt_client.Focus()
    End Sub
As I said - txt_client gets the Focus, but the the UpdatePanel seems to redraw itself and it loses focus. If I turn off PartialRendering, it works fine, but there's the obvious page refresh there...
Thanks
hello.
does that happen when you don't have an autocompleteextender attached to the textboxx?
That was one of my first thoughts ;) It does still happen w/o the autocompleteextender.
Thanks
hello.
hum...interesting...i've just build a small page that only has 2 textboxes and on the textchanged event of the 1st , i set the focus on the 2nd and it seems like i'ts working here...
Thanks for the reply! I stripped out all of my code and even took out the master page, but I have the same issue - this is what I have left below. Could you post the code you're trying with as well as your version of the Atlas DLL please? Thanks so much for your help!!
<%@. Page Language="VB" AutoEventWireup="false" CodeFile="Copy of ticket_entry.aspx.vb" Inherits="ticket_entry" title="Untitled Page"  EnableSessionState="true" EnableViewState="true"%>
<html>
<head runat=server></head
<body>
    <form id="form1" runat="server">
<atlas:ScriptManager ID="scriptmanager" EnablePartialRendering=true runat="server" />
<atlas:UpdatePanel ID="panel3" runat="server" Mode=Always EnableViewState=true  >
<ContentTemplate>
        Date:   
        <asp:TextBox ID="txt_date"  runat="server" AutoPostBack=true TabIndex="1" Width="50px">
        </asp:TextBox>
        Client:   
        <asp:TextBox ID="txt_client" runat=server AutoPostBack=true TabIndex="2" Columns="10"></asp:TextBox>
</ContentTemplate>
</atlas:UpdatePanel>
</form>
</body></html
And in code:
    Protected Sub txt_date_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles txt_date.TextChanged
        txt_client.Focus()
    End Sub
hello.
hum...interesting...or maybe not...i think that the problem is related with the replacement of the controls...this is only theory, though i really couldn't get the correct explanation for it.
so, i've just built a small workaround...see if works there:
<%@. Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
    void handle(object s, EventArgs a)
    {
        this.ClientScript.RegisterClientScriptBlock(this.GetType(), "H", "$('txt_client').focus();", true);
       
    }
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
        <atlas:ScriptManager ID="scriptmanager" EnablePartialRendering="true" runat="server" />
        <atlas:UpdatePanel ID="panel3" runat="server" Mode="Always" EnableViewState="true">
            <ContentTemplate>
                Date:   
                <asp:TextBox ID="txt_date" runat="server" AutoPostBack="true" TabIndex="1" Width="50px"
                    OnTextChanged="handle">
                </asp:TextBox>
                Client:   
                <asp:TextBox ID="txt_client" runat="server" TabIndex="2" Columns="10" ></asp:TextBox>            
            </ContentTemplate>
        </atlas:UpdatePanel>
        <div id="info">
        </div>       
    </form>
   <script type="text/javascript">
        Sys.Application.load.add( onload );
       
        function onload( obj, args )
        {
           $object("_PageRequestManager").propertyChanged.add( setFocus );
        }
  
       
       
        function setFocus( obj, args )
        {
            if( args.get_propertyName() && obj.get_inPostBack() == false)
            {               
                $("txt_client").focus();
            }
        }
   </script>
</body>
</html>
hello.
hum...interesting...or maybe not...i think that the problem is related with the replacement of the controls...this is only theory, though i really couldn't get the correct explanation for it.
so, i've just built a small workaround...see if works there:
<%@. Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
    void handle(object s, EventArgs a)
    {
        this.ClientScript.RegisterClientScriptBlock(this.GetType(), "H", "$('txt_client').focus();", true);
       
    }
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
        <atlas:ScriptManager ID="scriptmanager" EnablePartialRendering="true" runat="server" />
        <atlas:UpdatePanel ID="panel3" runat="server" Mode="Always" EnableViewState="true">
            <ContentTemplate>
                Date:   
                <asp:TextBox ID="txt_date" runat="server" AutoPostBack="true" TabIndex="1" Width="50px"
                    OnTextChanged="handle">
                </asp:TextBox>
                Client:   
                <asp:TextBox ID="txt_client" runat="server" TabIndex="2" Columns="10" ></asp:TextBox>            
            </ContentTemplate>
        </atlas:UpdatePanel>
        <div id="info">
        </div>       
    </form>
   <script type="text/javascript">
        Sys.Application.load.add( onload );
       
        function onload( obj, args )
        {
           $object("_PageRequestManager").propertyChanged.add( setFocus );
        }
  
       
       
        function setFocus( obj, args )
        {
            if( args.get_propertyName() && obj.get_inPostBack() == false)
            {               
                $("txt_client").focus();
            }
        }
   </script>
</body>
</html>
Hey - thanks for the reply.
I actually have a piece of JS that I wrote that will focus on the new tab index when enter is pressed. Still doesn't work.
Just out of curiosity - did you have the same problem with the code that I posted on your machine?
Would you mind posting the code that you tried that worked?
Thanks
hello again.
well, actually, the code was the same as yours...what happens here is that sometimes i get the focus and others i don't...when i first replied ot your post, i've runt teh code and it worked fine...it was only when i saw your code that i've tested it several times...
So I guess this qualifies as a bug?
Can someone on the Atlas team take a look at this?
Thanks
hello again.
i'm not really sure it's a bug...doesn't the approach i've mention work?
As I mentioned, I already had the following in my Master page:
In code:
        enterscript = "<SCRIPT LANGUAGE='JavaScript'>function okp(e,nextab){var kC; kC=e.which; if(e.which == undefined){kC=event.keyCode;}if(kC==13){chgfocus(nextab);return false;}}</script>"
        focuscript = "<SCRIPT LANGUAGE='JavaScript'>function chgfocus(nextab){for(i=0;i<document.forms[0].elements.length;i++){if(document.forms[0].elements[i].tabIndex==nextab){document.forms[0].elements[i].focus();}}}</SCRIPT>"
        Page.ClientScript.RegisterClientScriptBlock(Me.GetType, "okp", enterscript.ToString)
        Page.ClientScript.RegisterClientScriptBlock(Me.GetType, "chgfocus", focuscript.ToString)
In ASP:
<body  onkeypress="javascript:if(event.srcElement.type!='submit'){return okp(event,(event.srcElement.tabIndex+1));}"
This was just to give that "data entry" feel, where pressing enter would move to the next field. Even with the above code, I still have a problem.
Thanks again!
Has anybody else seen this kind of problem?
It's critical that my app work in IE and this is the last thing holding it up so any help would be appreciated!!
Thanks!
 
No comments:
Post a Comment