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

Ask a Question related to ASP.NET Data Grid Control, Design and Development.

  1. #1

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

    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
    [email]dlozzi@(remove-this)delphi-ts.com[/email]




    David Lozzi Guest

  2. Similar Questions and Discussions

    1. JavaScript: html list items within list items?
      Hi, I've seen how to implement a JavaScript to change the CSS class of every other list item in an unordered list, but, being new to JavaScript,...
    2. Editing only certain items.
      How do I set dynamically which items I want to edit when I go into Edit mode. The code below puts the entire row into Edit mode. The user has 2...
    3. Datagrid ... pain .... HELP!
      Hi every1, I have trying to learn datagrid to do simple things but since day 1 running into problems after problems for really simple things. ...
    4. How to use popup window editing datagrid items?
      Hello all, I have a datagrid bounded with an Arraylist containing contact objects, and a edit button (<asp:imagebutton/>) in each row When I...
    5. Footer not in datagrid items list
      I see many posts on this topic but still can't find a solution that works. I'm trying to access a dropdownlist in my datagrid footer when another...
  3. #2

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

    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
    [url]http://msdn.microsoft.com/library/en-us/vbcon/html/vbtskSpecifyingPagingBeha[/url]
    viorInDataGridWebControl.asp?frame=true

    #Walkthrough: Creating Paged Data Access Using a Web Forms Page
    [url]http://msdn.microsoft.com/library/en-us/vbcon/html/vbwlkwalkthroughdisplayin[/url]
    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! [url]www.microsoft.com/security[/url]
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)




















    --------------------
    | From: "David Lozzi" <DavidLozzi@nospam.nospam>
    | 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: <eH6N8Ja2FHA.1140@tk2msftngp13.phx.gbl>
    | Newsgroups: microsoft.public.dotnet.framework.aspnet.datagridc ontrol
    | NNTP-Posting-Host: c-24-63-42-200.hsd1.ma.comcast.net 24.63.42.200
    | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msft ngp13.phx.gbl
    | Xref: TK2MSFTNGXA01.phx.gbl
    microsoft.public.dotnet.framework.aspnet.datagridc ontrol:5861
    | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.datagridc ontrol
    |
    | 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
    | [email]dlozzi@(remove-this)delphi-ts.com[/email]
    |
    |
    |
    |
    |

    Steven Cheng[MSFT] Guest

  4. #3

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

    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! [url]www.microsoft.com/security[/url]
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
    --------------------
    | X-Tomcat-ID: 96786065
    | References: <eH6N8Ja2FHA.1140@tk2msftngp13.phx.gbl>
    | MIME-Version: 1.0
    | Content-Type: text/plain
    | Content-Transfer-Encoding: 7bit
    | From: [email]stcheng@online.microsoft.com[/email] (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.datagridc ontrol
    | Message-ID: <uD22m7e2FHA.3220@TK2MSFTNGXA01.phx.gbl>
    | Newsgroups: microsoft.public.dotnet.framework.aspnet.datagridc ontrol
    | Lines: 113
    | Path: TK2MSFTNGXA01.phx.gbl
    | Xref: TK2MSFTNGXA01.phx.gbl
    microsoft.public.dotnet.framework.aspnet.datagridc ontrol: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
    |
    [url]http://msdn.microsoft.com/library/en-us/vbcon/html/vbtskSpecifyingPagingBeha[/url]
    | viorInDataGridWebControl.asp?frame=true
    |
    | #Walkthrough: Creating Paged Data Access Using a Web Forms Page
    |
    [url]http://msdn.microsoft.com/library/en-us/vbcon/html/vbwlkwalkthroughdisplayin[/url]
    | 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! [url]www.microsoft.com/security[/url]
    | (This posting is provided "AS IS", with no warranties, and confers no
    | rights.)
    |
    |
    |
    |
    |
    |
    |
    |
    |
    |
    |
    |
    |
    |
    |
    |
    |
    |
    |
    |
    | --------------------
    | | From: "David Lozzi" <DavidLozzi@nospam.nospam>
    | | 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: <eH6N8Ja2FHA.1140@tk2msftngp13.phx.gbl>
    | | Newsgroups: microsoft.public.dotnet.framework.aspnet.datagridc ontrol
    | | NNTP-Posting-Host: c-24-63-42-200.hsd1.ma.comcast.net 24.63.42.200
    | | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msft ngp13.phx.gbl
    | | Xref: TK2MSFTNGXA01.phx.gbl
    | microsoft.public.dotnet.framework.aspnet.datagridc ontrol:5861
    | | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.datagridc ontrol
    | |
    | | 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
    | | [email]dlozzi@(remove-this)delphi-ts.com[/email]
    | |
    | |
    | |
    | |
    | |
    |
    |

    Steven Cheng[MSFT] Guest

  5. #4

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

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

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



    "Steven Cheng[MSFT]" <stcheng@online.microsoft.com> wrote in message
    news:HQX%23ZUI4FHA.2904@TK2MSFTNGXA01.phx.gbl...
    > 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! [url]www.microsoft.com/security[/url]
    > (This posting is provided "AS IS", with no warranties, and confers no
    > rights.)
    > --------------------
    > | X-Tomcat-ID: 96786065
    > | References: <eH6N8Ja2FHA.1140@tk2msftngp13.phx.gbl>
    > | MIME-Version: 1.0
    > | Content-Type: text/plain
    > | Content-Transfer-Encoding: 7bit
    > | From: [email]stcheng@online.microsoft.com[/email] (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.datagridc ontrol
    > | Message-ID: <uD22m7e2FHA.3220@TK2MSFTNGXA01.phx.gbl>
    > | Newsgroups: microsoft.public.dotnet.framework.aspnet.datagridc ontrol
    > | Lines: 113
    > | Path: TK2MSFTNGXA01.phx.gbl
    > | Xref: TK2MSFTNGXA01.phx.gbl
    > microsoft.public.dotnet.framework.aspnet.datagridc ontrol: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
    > |
    > [url]http://msdn.microsoft.com/library/en-us/vbcon/html/vbtskSpecifyingPagingBeha[/url]
    > | viorInDataGridWebControl.asp?frame=true
    > |
    > | #Walkthrough: Creating Paged Data Access Using a Web Forms Page
    > |
    > [url]http://msdn.microsoft.com/library/en-us/vbcon/html/vbwlkwalkthroughdisplayin[/url]
    > | 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! [url]www.microsoft.com/security[/url]
    > | (This posting is provided "AS IS", with no warranties, and confers no
    > | rights.)
    > |
    > |
    > |
    > |
    > |
    > |
    > |
    > |
    > |
    > |
    > |
    > |
    > |
    > |
    > |
    > |
    > |
    > |
    > |
    > |
    > | --------------------
    > | | From: "David Lozzi" <DavidLozzi@nospam.nospam>
    > | | 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: <eH6N8Ja2FHA.1140@tk2msftngp13.phx.gbl>
    > | | Newsgroups: microsoft.public.dotnet.framework.aspnet.datagridc ontrol
    > | | NNTP-Posting-Host: c-24-63-42-200.hsd1.ma.comcast.net 24.63.42.200
    > | | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msft ngp13.phx.gbl
    > | | Xref: TK2MSFTNGXA01.phx.gbl
    > | microsoft.public.dotnet.framework.aspnet.datagridc ontrol:5861
    > | | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.datagridc ontrol
    > | |
    > | | 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
    > | | [email]dlozzi@(remove-this)delphi-ts.com[/email]
    > | |
    > | |
    > | |
    > | |
    > | |
    > |
    > |
    >

    David Lozzi Guest

  6. #5

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

    Thank you David,

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

    Regards,


    Steven Cheng
    Microsoft Online Support

    Get Secure! [url]www.microsoft.com/security[/url]
    (This posting is provided "AS IS", with no warranties, and confers no
    rights.)
    --------------------
    | From: "David Lozzi" <DavidLozzi@nospam.nospam>
    | References: <eH6N8Ja2FHA.1140@tk2msftngp13.phx.gbl>
    <uD22m7e2FHA.3220@TK2MSFTNGXA01.phx.gbl>
    <HQX#ZUI4FHA.2904@TK2MSFTNGXA01.phx.gbl>
    | 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: <#yKIRQI5FHA.2864@tk2msftngp13.phx.gbl>
    | Newsgroups: microsoft.public.dotnet.framework.aspnet.datagridc ontrol
    | NNTP-Posting-Host: c-24-63-42-200.hsd1.ma.comcast.net 24.63.42.200
    | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msft ngp13.phx.gbl
    | Xref: TK2MSFTNGXA01.phx.gbl
    microsoft.public.dotnet.framework.aspnet.datagridc ontrol:5979
    | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.datagridc ontrol
    |
    | Yes, I'm using paging for the datagrid, which works great. Thank you!!
    |
    | --
    | David Lozzi
    | Web Applications Developer
    | [email]dlozzi@(remove-this)delphi-ts.com[/email]
    |
    |
    |
    | "Steven Cheng[MSFT]" <stcheng@online.microsoft.com> wrote in message
    | news:HQX%23ZUI4FHA.2904@TK2MSFTNGXA01.phx.gbl...
    | > 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! [url]www.microsoft.com/security[/url]
    | > (This posting is provided "AS IS", with no warranties, and confers no
    | > rights.)
    | > --------------------
    | > | X-Tomcat-ID: 96786065
    | > | References: <eH6N8Ja2FHA.1140@tk2msftngp13.phx.gbl>
    | > | MIME-Version: 1.0
    | > | Content-Type: text/plain
    | > | Content-Transfer-Encoding: 7bit
    | > | From: [email]stcheng@online.microsoft.com[/email] (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.datagridc ontrol
    | > | Message-ID: <uD22m7e2FHA.3220@TK2MSFTNGXA01.phx.gbl>
    | > | Newsgroups: microsoft.public.dotnet.framework.aspnet.datagridc ontrol
    | > | Lines: 113
    | > | Path: TK2MSFTNGXA01.phx.gbl
    | > | Xref: TK2MSFTNGXA01.phx.gbl
    | > microsoft.public.dotnet.framework.aspnet.datagridc ontrol: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
    | > |
    | >
    [url]http://msdn.microsoft.com/library/en-us/vbcon/html/vbtskSpecifyingPagingBeha[/url]
    | > | viorInDataGridWebControl.asp?frame=true
    | > |
    | > | #Walkthrough: Creating Paged Data Access Using a Web Forms Page
    | > |
    | >
    [url]http://msdn.microsoft.com/library/en-us/vbcon/html/vbwlkwalkthroughdisplayin[/url]
    | > | 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! [url]www.microsoft.com/security[/url]
    | > | (This posting is provided "AS IS", with no warranties, and confers no
    | > | rights.)
    | > |
    | > |
    | > |
    | > |
    | > |
    | > |
    | > |
    | > |
    | > |
    | > |
    | > |
    | > |
    | > |
    | > |
    | > |
    | > |
    | > |
    | > |
    | > |
    | > |
    | > | --------------------
    | > | | From: "David Lozzi" <DavidLozzi@nospam.nospam>
    | > | | 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: <eH6N8Ja2FHA.1140@tk2msftngp13.phx.gbl>
    | > | | Newsgroups: microsoft.public.dotnet.framework.aspnet.datagridc ontrol
    | > | | NNTP-Posting-Host: c-24-63-42-200.hsd1.ma.comcast.net 24.63.42.200
    | > | | Path:
    TK2MSFTNGXA01.phx.gbl!TK2MSFTNGP08.phx.gbl!tk2msft ngp13.phx.gbl
    | > | | Xref: TK2MSFTNGXA01.phx.gbl
    | > | microsoft.public.dotnet.framework.aspnet.datagridc ontrol:5861
    | > | | X-Tomcat-NG:
    microsoft.public.dotnet.framework.aspnet.datagridc ontrol
    | > | |
    | > | | 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
    | > | | [email]dlozzi@(remove-this)delphi-ts.com[/email]
    | > | |
    | > | |
    | > | |
    | > | |
    | > | |
    | > |
    | > |
    | >
    |
    |
    |

    Steven Cheng[MSFT] Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139