Long list of items in my datagrid, editing is a pain!!

Discussion in 'ASP .Net Datagrid Control' started by David Lozzi, Oct 25, 2005.

  1. David Lozzi

    David Lozzi Guest

    Hello,

    I'm loading a datagrid from an XML file. I'm using datagrids edit
    functionality and its working great. My problem is that this list is 667
    records. When I press Edit the page reloads and starts at the top. Then I
    have to scroll all the way down to get back to the item I'm editing. I guess
    I have one of two questions that needs answering:

    1) Can I page through XML? If So, How?

    2) Is there a way to possibly use anchors so that the page refreshes and
    moves to the record I am working with?

    Thanks a ton!!!

    --
    David Lozzi
    Web Applications Developer
    dlozzi@(remove-this)delphi-ts.com
    David Lozzi, Oct 25, 2005
    #1
    1. Advertising

  2. Hi David,

    Hi Welcome to ASPNET newsgroup.
    Regarding on the questions you mentioned, here are some of my suggestions:

    1) Can I page through XML? If So, How?
    ===================================
    For paging , since you're not using the ADO.NET data components (DataSet,
    DataTable..), I think you'd use the custom paging of the asp.net datagrid.
    What we need to do is register the Paging event for datagrid and then bind
    the certain page's data items to the datagrid in the Paging event handler.
    here are some msdn reference on this:

    #Specifying Paging Behavior in a DataGrid Web Server Control
    http://msdn.microsoft.com/library/en-us/vbcon/html/vbtskSpecifyingPagingBeha
    viorInDataGridWebControl.asp?frame=true

    #Walkthrough: Creating Paged Data Access Using a Web Forms Page
    http://msdn.microsoft.com/library/en-us/vbcon/html/vbwlkwalkthroughdisplayin
    gdatainlistboxesonwebformspage.asp?frame=true


    2) Is there a way to possibly use anchors so that the page refreshes and
    moves to the record I am working with?
    =======================================
    For keeping page's focus on the current editing item (or selecting
    item...). We have the following two options:

    a) register a simple clientscript code whch use the html element's focus()
    method to set focus on the current item when the page has been loaded at
    clientside( Page.RegisterStartupScript...). However, in this case we need
    to have a certain identified control in our template column so that we can
    use that control to set the focus.

    e.g:
    we have the following template column:
    =======================
    <asp:TemplateColumn>
    <ItemTemplate>
    <asp:TextBox ID="txtFocus" Runat="server" Width="1"
    Height="1"></asp:TextBox>
    </ItemTemplate>
    <EditItemTemplate>
    <asp:TextBox ID="txtFocus" Runat="server" Width="1"
    Height="1"></asp:TextBox>
    </EditItemTemplate>
    </asp:TemplateColumn>
    ======================

    we can use the following code in ItemCommand to set the focus:
    ==========================
    private void DataGrid1_EditCommand(object source,
    System.Web.UI.WebControls.DataGridCommandEventArgs e)
    {
    DataGrid1.EditItemIndex = e.Item.ItemIndex;
    DataGrid1.DataSource = GetDataSource();
    DataGrid1.DataBind();

    Control ctrl = e.Item.FindControl("txtFocus");
    string script = @"<script language='javascript'>
    document.getElementById('{0}').focus();
    </script>";


    Page.RegisterStartupScript("page_set_focus",string.Format(script,ctrl.Client
    ID));
    }
    ========================


    b) We can turn on smartNavigation on the page we need to keep focus between
    postback

    IMO, I prefer the a) since it's more lightweight( smartnavigation will
    somewhat impact performance )

    Hope helps. Thanks,

    Steven Cheng
    Microsoft Online Support

    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)




















    --------------------
    | From: "David Lozzi" <>
    | Subject: Long list of items in my datagrid, editing is a pain!!
    | Date: Tue, 25 Oct 2005 16:26:33 -0400
    | Lines: 23
    | X-Priority: 3
    | X-MSMail-Priority: Normal
    | X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
    | X-RFC2646: Format=Flowed; Original
    | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
    | Message-ID: <>
    | Newsgroups: microsoft.public.dotnet.framework.aspnet.datagridcontrol
    | NNTP-Posting-Host: c-24-63-42-200.hsd1.ma.comcast.net 24.63.42.200
    | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
    | Xref: TK2MSFTNGXA01.phx.gbl
    microsoft.public.dotnet.framework.aspnet.datagridcontrol:5861
    | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.datagridcontrol
    |
    | Hello,
    |
    | I'm loading a datagrid from an XML file. I'm using datagrids edit
    | functionality and its working great. My problem is that this list is 667
    | records. When I press Edit the page reloads and starts at the top. Then I
    | have to scroll all the way down to get back to the item I'm editing. I
    guess
    | I have one of two questions that needs answering:
    |
    | 1) Can I page through XML? If So, How?
    |
    | 2) Is there a way to possibly use anchors so that the page refreshes and
    | moves to the record I am working with?
    |
    | Thanks a ton!!!
    |
    | --
    | David Lozzi
    | Web Applications Developer
    | dlozzi@(remove-this)delphi-ts.com
    |
    |
    |
    |
    |
    Steven Cheng[MSFT], Oct 26, 2005
    #2
    1. Advertising

  3. Hi David,

    How are you doing on this issue , does the things in my last reply helps a
    little? If there're anything else we can help, please feel free to post
    here. Thanks,

    Steven Cheng
    Microsoft Online Support

    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
    --------------------
    | X-Tomcat-ID: 96786065
    | References: <>
    | MIME-Version: 1.0
    | Content-Type: text/plain
    | Content-Transfer-Encoding: 7bit
    | From: (Steven Cheng[MSFT])
    | Organization: Microsoft
    | Date: Wed, 26 Oct 2005 05:33:55 GMT
    | Subject: RE: Long list of items in my datagrid, editing is a pain!!
    | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.datagridcontrol
    | Message-ID: <>
    | Newsgroups: microsoft.public.dotnet.framework.aspnet.datagridcontrol
    | Lines: 113
    | Path: TK2MSFTNGXA01.phx.gbl
    | Xref: TK2MSFTNGXA01.phx.gbl
    microsoft.public.dotnet.framework.aspnet.datagridcontrol:5864
    | NNTP-Posting-Host: TOMCATIMPORT1 10.201.218.122
    |
    | Hi David,
    |
    | Hi Welcome to ASPNET newsgroup.
    | Regarding on the questions you mentioned, here are some of my suggestions:
    |
    | 1) Can I page through XML? If So, How?
    | ===================================
    | For paging , since you're not using the ADO.NET data components (DataSet,
    | DataTable..), I think you'd use the custom paging of the asp.net
    datagrid.
    | What we need to do is register the Paging event for datagrid and then
    bind
    | the certain page's data items to the datagrid in the Paging event
    handler.
    | here are some msdn reference on this:
    |
    | #Specifying Paging Behavior in a DataGrid Web Server Control
    |
    http://msdn.microsoft.com/library/en-us/vbcon/html/vbtskSpecifyingPagingBeha
    | viorInDataGridWebControl.asp?frame=true
    |
    | #Walkthrough: Creating Paged Data Access Using a Web Forms Page
    |
    http://msdn.microsoft.com/library/en-us/vbcon/html/vbwlkwalkthroughdisplayin
    | gdatainlistboxesonwebformspage.asp?frame=true
    |
    |
    | 2) Is there a way to possibly use anchors so that the page refreshes and
    | moves to the record I am working with?
    | =======================================
    | For keeping page's focus on the current editing item (or selecting
    | item...). We have the following two options:
    |
    | a) register a simple clientscript code whch use the html element's
    focus()
    | method to set focus on the current item when the page has been loaded at
    | clientside( Page.RegisterStartupScript...). However, in this case we need
    | to have a certain identified control in our template column so that we
    can
    | use that control to set the focus.
    |
    | e.g:
    | we have the following template column:
    | =======================
    | <asp:TemplateColumn>
    | <ItemTemplate>
    | <asp:TextBox ID="txtFocus" Runat="server" Width="1"
    | Height="1"></asp:TextBox>
    | </ItemTemplate>
    | <EditItemTemplate>
    | <asp:TextBox ID="txtFocus" Runat="server" Width="1"
    | Height="1"></asp:TextBox>
    | </EditItemTemplate>
    | </asp:TemplateColumn>
    | ======================
    |
    | we can use the following code in ItemCommand to set the focus:
    | ==========================
    | private void DataGrid1_EditCommand(object source,
    | System.Web.UI.WebControls.DataGridCommandEventArgs e)
    | {
    | DataGrid1.EditItemIndex = e.Item.ItemIndex;
    | DataGrid1.DataSource = GetDataSource();
    | DataGrid1.DataBind();
    |
    | Control ctrl = e.Item.FindControl("txtFocus");
    | string script = @"<script language='javascript'>
    | document.getElementById('{0}').focus();
    | </script>";
    |
    |
    |
    Page.RegisterStartupScript("page_set_focus",string.Format(script,ctrl.Client
    | ID));
    | }
    | ========================
    |
    |
    | b) We can turn on smartNavigation on the page we need to keep focus
    between
    | postback
    |
    | IMO, I prefer the a) since it's more lightweight( smartnavigation will
    | somewhat impact performance )
    |
    | Hope helps. Thanks,
    |
    | Steven Cheng
    | Microsoft Online Support
    |
    | Get Secure! www.microsoft.com/security
    | (This posting is provided "AS IS", with no warranties, and confers no
    | rights.)
    |
    |
    |
    |
    |
    |
    |
    |
    |
    |
    |
    |
    |
    |
    |
    |
    |
    |
    |
    |
    | --------------------
    | | From: "David Lozzi" <>
    | | Subject: Long list of items in my datagrid, editing is a pain!!
    | | Date: Tue, 25 Oct 2005 16:26:33 -0400
    | | Lines: 23
    | | X-Priority: 3
    | | X-MSMail-Priority: Normal
    | | X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
    | | X-RFC2646: Format=Flowed; Original
    | | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
    | | Message-ID: <>
    | | Newsgroups: microsoft.public.dotnet.framework.aspnet.datagridcontrol
    | | NNTP-Posting-Host: c-24-63-42-200.hsd1.ma.comcast.net 24.63.42.200
    | | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
    | | Xref: TK2MSFTNGXA01.phx.gbl
    | microsoft.public.dotnet.framework.aspnet.datagridcontrol:5861
    | | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.datagridcontrol
    | |
    | | Hello,
    | |
    | | I'm loading a datagrid from an XML file. I'm using datagrids edit
    | | functionality and its working great. My problem is that this list is
    667
    | | records. When I press Edit the page reloads and starts at the top. Then
    I
    | | have to scroll all the way down to get back to the item I'm editing. I
    | guess
    | | I have one of two questions that needs answering:
    | |
    | | 1) Can I page through XML? If So, How?
    | |
    | | 2) Is there a way to possibly use anchors so that the page refreshes
    and
    | | moves to the record I am working with?
    | |
    | | Thanks a ton!!!
    | |
    | | --
    | | David Lozzi
    | | Web Applications Developer
    | | dlozzi@(remove-this)delphi-ts.com
    | |
    | |
    | |
    | |
    | |
    |
    |
    Steven Cheng[MSFT], Nov 3, 2005
    #3
  4. David Lozzi

    David Lozzi Guest

    Yes, I'm using paging for the datagrid, which works great. Thank you!!

    --
    David Lozzi
    Web Applications Developer
    dlozzi@(remove-this)delphi-ts.com



    "Steven Cheng[MSFT]" <> wrote in message
    news:HQX%...
    > Hi David,
    >
    > How are you doing on this issue , does the things in my last reply helps a
    > little? If there're anything else we can help, please feel free to post
    > here. Thanks,
    >
    > Steven Cheng
    > Microsoft Online Support
    >
    > Get Secure! www.microsoft.com/security
    > (This posting is provided "AS IS", with no warranties, and confers no
    > rights.)
    > --------------------
    > | X-Tomcat-ID: 96786065
    > | References: <>
    > | MIME-Version: 1.0
    > | Content-Type: text/plain
    > | Content-Transfer-Encoding: 7bit
    > | From: (Steven Cheng[MSFT])
    > | Organization: Microsoft
    > | Date: Wed, 26 Oct 2005 05:33:55 GMT
    > | Subject: RE: Long list of items in my datagrid, editing is a pain!!
    > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.datagridcontrol
    > | Message-ID: <>
    > | Newsgroups: microsoft.public.dotnet.framework.aspnet.datagridcontrol
    > | Lines: 113
    > | Path: TK2MSFTNGXA01.phx.gbl
    > | Xref: TK2MSFTNGXA01.phx.gbl
    > microsoft.public.dotnet.framework.aspnet.datagridcontrol:5864
    > | NNTP-Posting-Host: TOMCATIMPORT1 10.201.218.122
    > |
    > | Hi David,
    > |
    > | Hi Welcome to ASPNET newsgroup.
    > | Regarding on the questions you mentioned, here are some of my
    > suggestions:
    > |
    > | 1) Can I page through XML? If So, How?
    > | ===================================
    > | For paging , since you're not using the ADO.NET data components
    > (DataSet,
    > | DataTable..), I think you'd use the custom paging of the asp.net
    > datagrid.
    > | What we need to do is register the Paging event for datagrid and then
    > bind
    > | the certain page's data items to the datagrid in the Paging event
    > handler.
    > | here are some msdn reference on this:
    > |
    > | #Specifying Paging Behavior in a DataGrid Web Server Control
    > |
    > http://msdn.microsoft.com/library/en-us/vbcon/html/vbtskSpecifyingPagingBeha
    > | viorInDataGridWebControl.asp?frame=true
    > |
    > | #Walkthrough: Creating Paged Data Access Using a Web Forms Page
    > |
    > http://msdn.microsoft.com/library/en-us/vbcon/html/vbwlkwalkthroughdisplayin
    > | gdatainlistboxesonwebformspage.asp?frame=true
    > |
    > |
    > | 2) Is there a way to possibly use anchors so that the page refreshes and
    > | moves to the record I am working with?
    > | =======================================
    > | For keeping page's focus on the current editing item (or selecting
    > | item...). We have the following two options:
    > |
    > | a) register a simple clientscript code whch use the html element's
    > focus()
    > | method to set focus on the current item when the page has been loaded at
    > | clientside( Page.RegisterStartupScript...). However, in this case we
    > need
    > | to have a certain identified control in our template column so that we
    > can
    > | use that control to set the focus.
    > |
    > | e.g:
    > | we have the following template column:
    > | =======================
    > | <asp:TemplateColumn>
    > | <ItemTemplate>
    > | <asp:TextBox ID="txtFocus" Runat="server" Width="1"
    > | Height="1"></asp:TextBox>
    > | </ItemTemplate>
    > | <EditItemTemplate>
    > | <asp:TextBox ID="txtFocus" Runat="server" Width="1"
    > | Height="1"></asp:TextBox>
    > | </EditItemTemplate>
    > | </asp:TemplateColumn>
    > | ======================
    > |
    > | we can use the following code in ItemCommand to set the focus:
    > | ==========================
    > | private void DataGrid1_EditCommand(object source,
    > | System.Web.UI.WebControls.DataGridCommandEventArgs e)
    > | {
    > | DataGrid1.EditItemIndex = e.Item.ItemIndex;
    > | DataGrid1.DataSource = GetDataSource();
    > | DataGrid1.DataBind();
    > |
    > | Control ctrl = e.Item.FindControl("txtFocus");
    > | string script = @"<script language='javascript'>
    > | document.getElementById('{0}').focus();
    > | </script>";
    > |
    > |
    > |
    > Page.RegisterStartupScript("page_set_focus",string.Format(script,ctrl.Client
    > | ID));
    > | }
    > | ========================
    > |
    > |
    > | b) We can turn on smartNavigation on the page we need to keep focus
    > between
    > | postback
    > |
    > | IMO, I prefer the a) since it's more lightweight( smartnavigation will
    > | somewhat impact performance )
    > |
    > | Hope helps. Thanks,
    > |
    > | Steven Cheng
    > | Microsoft Online Support
    > |
    > | Get Secure! www.microsoft.com/security
    > | (This posting is provided "AS IS", with no warranties, and confers no
    > | rights.)
    > |
    > |
    > |
    > |
    > |
    > |
    > |
    > |
    > |
    > |
    > |
    > |
    > |
    > |
    > |
    > |
    > |
    > |
    > |
    > |
    > | --------------------
    > | | From: "David Lozzi" <>
    > | | Subject: Long list of items in my datagrid, editing is a pain!!
    > | | Date: Tue, 25 Oct 2005 16:26:33 -0400
    > | | Lines: 23
    > | | X-Priority: 3
    > | | X-MSMail-Priority: Normal
    > | | X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
    > | | X-RFC2646: Format=Flowed; Original
    > | | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
    > | | Message-ID: <>
    > | | Newsgroups: microsoft.public.dotnet.framework.aspnet.datagridcontrol
    > | | NNTP-Posting-Host: c-24-63-42-200.hsd1.ma.comcast.net 24.63.42.200
    > | | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
    > | | Xref: TK2MSFTNGXA01.phx.gbl
    > | microsoft.public.dotnet.framework.aspnet.datagridcontrol:5861
    > | | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.datagridcontrol
    > | |
    > | | Hello,
    > | |
    > | | I'm loading a datagrid from an XML file. I'm using datagrids edit
    > | | functionality and its working great. My problem is that this list is
    > 667
    > | | records. When I press Edit the page reloads and starts at the top.
    > Then
    > I
    > | | have to scroll all the way down to get back to the item I'm editing. I
    > | guess
    > | | I have one of two questions that needs answering:
    > | |
    > | | 1) Can I page through XML? If So, How?
    > | |
    > | | 2) Is there a way to possibly use anchors so that the page refreshes
    > and
    > | | moves to the record I am working with?
    > | |
    > | | Thanks a ton!!!
    > | |
    > | | --
    > | | David Lozzi
    > | | Web Applications Developer
    > | | dlozzi@(remove-this)delphi-ts.com
    > | |
    > | |
    > | |
    > | |
    > | |
    > |
    > |
    >
    David Lozzi, Nov 8, 2005
    #4
  5. Thank you David,

    Please feel to post here when you need any further assistance.

    Regards,


    Steven Cheng
    Microsoft Online Support

    Get Secure! www.microsoft.com/security
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
    --------------------
    | From: "David Lozzi" <>
    | References: <>
    <>
    <HQX#>
    | Subject: Re: Long list of items in my datagrid, editing is a pain!!
    | Date: Tue, 8 Nov 2005 11:46:44 -0500
    | Lines: 210
    | X-Priority: 3
    | X-MSMail-Priority: Normal
    | X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
    | X-RFC2646: Format=Flowed; Original
    | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
    | Message-ID: <#>
    | Newsgroups: microsoft.public.dotnet.framework.aspnet.datagridcontrol
    | NNTP-Posting-Host: c-24-63-42-200.hsd1.ma.comcast.net 24.63.42.200
    | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
    | Xref: TK2MSFTNGXA01.phx.gbl
    microsoft.public.dotnet.framework.aspnet.datagridcontrol:5979
    | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.datagridcontrol
    |
    | Yes, I'm using paging for the datagrid, which works great. Thank you!!
    |
    | --
    | David Lozzi
    | Web Applications Developer
    | dlozzi@(remove-this)delphi-ts.com
    |
    |
    |
    | "Steven Cheng[MSFT]" <> wrote in message
    | news:HQX%...
    | > Hi David,
    | >
    | > How are you doing on this issue , does the things in my last reply
    helps a
    | > little? If there're anything else we can help, please feel free to post
    | > here. Thanks,
    | >
    | > Steven Cheng
    | > Microsoft Online Support
    | >
    | > Get Secure! www.microsoft.com/security
    | > (This posting is provided "AS IS", with no warranties, and confers no
    | > rights.)
    | > --------------------
    | > | X-Tomcat-ID: 96786065
    | > | References: <>
    | > | MIME-Version: 1.0
    | > | Content-Type: text/plain
    | > | Content-Transfer-Encoding: 7bit
    | > | From: (Steven Cheng[MSFT])
    | > | Organization: Microsoft
    | > | Date: Wed, 26 Oct 2005 05:33:55 GMT
    | > | Subject: RE: Long list of items in my datagrid, editing is a pain!!
    | > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.datagridcontrol
    | > | Message-ID: <>
    | > | Newsgroups: microsoft.public.dotnet.framework.aspnet.datagridcontrol
    | > | Lines: 113
    | > | Path: TK2MSFTNGXA01.phx.gbl
    | > | Xref: TK2MSFTNGXA01.phx.gbl
    | > microsoft.public.dotnet.framework.aspnet.datagridcontrol:5864
    | > | NNTP-Posting-Host: TOMCATIMPORT1 10.201.218.122
    | > |
    | > | Hi David,
    | > |
    | > | Hi Welcome to ASPNET newsgroup.
    | > | Regarding on the questions you mentioned, here are some of my
    | > suggestions:
    | > |
    | > | 1) Can I page through XML? If So, How?
    | > | ===================================
    | > | For paging , since you're not using the ADO.NET data components
    | > (DataSet,
    | > | DataTable..), I think you'd use the custom paging of the asp.net
    | > datagrid.
    | > | What we need to do is register the Paging event for datagrid and then
    | > bind
    | > | the certain page's data items to the datagrid in the Paging event
    | > handler.
    | > | here are some msdn reference on this:
    | > |
    | > | #Specifying Paging Behavior in a DataGrid Web Server Control
    | > |
    | >
    http://msdn.microsoft.com/library/en-us/vbcon/html/vbtskSpecifyingPagingBeha
    | > | viorInDataGridWebControl.asp?frame=true
    | > |
    | > | #Walkthrough: Creating Paged Data Access Using a Web Forms Page
    | > |
    | >
    http://msdn.microsoft.com/library/en-us/vbcon/html/vbwlkwalkthroughdisplayin
    | > | gdatainlistboxesonwebformspage.asp?frame=true
    | > |
    | > |
    | > | 2) Is there a way to possibly use anchors so that the page refreshes
    and
    | > | moves to the record I am working with?
    | > | =======================================
    | > | For keeping page's focus on the current editing item (or selecting
    | > | item...). We have the following two options:
    | > |
    | > | a) register a simple clientscript code whch use the html element's
    | > focus()
    | > | method to set focus on the current item when the page has been loaded
    at
    | > | clientside( Page.RegisterStartupScript...). However, in this case we
    | > need
    | > | to have a certain identified control in our template column so that we
    | > can
    | > | use that control to set the focus.
    | > |
    | > | e.g:
    | > | we have the following template column:
    | > | =======================
    | > | <asp:TemplateColumn>
    | > | <ItemTemplate>
    | > | <asp:TextBox ID="txtFocus" Runat="server" Width="1"
    | > | Height="1"></asp:TextBox>
    | > | </ItemTemplate>
    | > | <EditItemTemplate>
    | > | <asp:TextBox ID="txtFocus" Runat="server" Width="1"
    | > | Height="1"></asp:TextBox>
    | > | </EditItemTemplate>
    | > | </asp:TemplateColumn>
    | > | ======================
    | > |
    | > | we can use the following code in ItemCommand to set the focus:
    | > | ==========================
    | > | private void DataGrid1_EditCommand(object source,
    | > | System.Web.UI.WebControls.DataGridCommandEventArgs e)
    | > | {
    | > | DataGrid1.EditItemIndex = e.Item.ItemIndex;
    | > | DataGrid1.DataSource = GetDataSource();
    | > | DataGrid1.DataBind();
    | > |
    | > | Control ctrl = e.Item.FindControl("txtFocus");
    | > | string script = @"<script language='javascript'>
    | > | document.getElementById('{0}').focus();
    | > | </script>";
    | > |
    | > |
    | > |
    | >
    Page.RegisterStartupScript("page_set_focus",string.Format(script,ctrl.Client
    | > | ID));
    | > | }
    | > | ========================
    | > |
    | > |
    | > | b) We can turn on smartNavigation on the page we need to keep focus
    | > between
    | > | postback
    | > |
    | > | IMO, I prefer the a) since it's more lightweight( smartnavigation will
    | > | somewhat impact performance )
    | > |
    | > | Hope helps. Thanks,
    | > |
    | > | Steven Cheng
    | > | Microsoft Online Support
    | > |
    | > | Get Secure! www.microsoft.com/security
    | > | (This posting is provided "AS IS", with no warranties, and confers no
    | > | rights.)
    | > |
    | > |
    | > |
    | > |
    | > |
    | > |
    | > |
    | > |
    | > |
    | > |
    | > |
    | > |
    | > |
    | > |
    | > |
    | > |
    | > |
    | > |
    | > |
    | > |
    | > | --------------------
    | > | | From: "David Lozzi" <>
    | > | | Subject: Long list of items in my datagrid, editing is a pain!!
    | > | | Date: Tue, 25 Oct 2005 16:26:33 -0400
    | > | | Lines: 23
    | > | | X-Priority: 3
    | > | | X-MSMail-Priority: Normal
    | > | | X-Newsreader: Microsoft Outlook Express 6.00.2900.2670
    | > | | X-RFC2646: Format=Flowed; Original
    | > | | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2670
    | > | | Message-ID: <>
    | > | | Newsgroups: microsoft.public.dotnet.framework.aspnet.datagridcontrol
    | > | | NNTP-Posting-Host: c-24-63-42-200.hsd1.ma.comcast.net 24.63.42.200
    | > | | Path:
    TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msftngp13.phx.gbl
    | > | | Xref: TK2MSFTNGXA01.phx.gbl
    | > | microsoft.public.dotnet.framework.aspnet.datagridcontrol:5861
    | > | | X-Tomcat-NG:
    microsoft.public.dotnet.framework.aspnet.datagridcontrol
    | > | |
    | > | | Hello,
    | > | |
    | > | | I'm loading a datagrid from an XML file. I'm using datagrids edit
    | > | | functionality and its working great. My problem is that this list
    is
    | > 667
    | > | | records. When I press Edit the page reloads and starts at the top.
    | > Then
    | > I
    | > | | have to scroll all the way down to get back to the item I'm
    editing. I
    | > | guess
    | > | | I have one of two questions that needs answering:
    | > | |
    | > | | 1) Can I page through XML? If So, How?
    | > | |
    | > | | 2) Is there a way to possibly use anchors so that the page refreshes
    | > and
    | > | | moves to the record I am working with?
    | > | |
    | > | | Thanks a ton!!!
    | > | |
    | > | | --
    | > | | David Lozzi
    | > | | Web Applications Developer
    | > | | dlozzi@(remove-this)delphi-ts.com
    | > | |
    | > | |
    | > | |
    | > | |
    | > | |
    | > |
    | > |
    | >
    |
    |
    |
    Steven Cheng[MSFT], Nov 9, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. George Marsaglia

    Assigning unsigned long to unsigned long long

    George Marsaglia, Jul 8, 2003, in forum: C Programming
    Replies:
    1
    Views:
    674
    Eric Sosman
    Jul 8, 2003
  2. Daniel Rudy

    unsigned long long int to long double

    Daniel Rudy, Sep 19, 2005, in forum: C Programming
    Replies:
    5
    Views:
    1,186
    Peter Shaggy Haywood
    Sep 20, 2005
  3. Mathieu Dutour

    long long and long

    Mathieu Dutour, Jul 17, 2007, in forum: C Programming
    Replies:
    4
    Views:
    473
    santosh
    Jul 24, 2007
  4. Bart C

    Use of Long and Long Long

    Bart C, Jan 9, 2008, in forum: C Programming
    Replies:
    27
    Views:
    797
    Peter Nilsson
    Jan 15, 2008
  5. David

    Split long list of list items

    David, Aug 25, 2006, in forum: Javascript
    Replies:
    7
    Views:
    135
    David
    Aug 25, 2006
Loading...

Share This Page