Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6833575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:59:43+00:00 2026-05-26T22:59:43+00:00

Windows 7, visual web developer express 2010, c#, asp.net, webforms. Running program with ctrl-F5

  • 0

Windows 7, visual web developer express 2010, c#, asp.net, webforms. Running program with ctrl-F5 from vwd.

Using tabs with an asp:listview on each tab. I have code-behind the items in each listview.
The code behind uses an ID (from the item) to pull a record from a database (mdf file) via xsd. to populate textboxes on the page.

When I click on an item, the program properly grabs the correct record and properly puts the information from that record into the textboxes on the screen. The problem is that it’s either refreshing or reloading the page … which causes it to go to the first tab instead of the tab I’m on. I assume this would be disconcerting and unexpected to the user (it’s disconcerting and unexpected to me).

Here’s how I handle the code behind for an item click in the listview:

    protected void lv_PBP_click(object sender, ListViewCommandEventArgs e)
    {
        if (!e.CommandName.Equals("Sort"))
        {
            int searchID = Convert.ToInt32(e.CommandArgument.ToString());
            TableAdapters.PBPTableAdapter pbpAdapt =
                new TableAdapters.PBPTableAdapter();
            PBPDataTable tbl = pbpAdapt.GetData(searchID);
            tbMessage.Text = tbl.Rows[0]["pMessage"].ToString();
            lbField2.Text = tbl.Rows[0]["pField2"].ToString();
            lbField3.Text = tbl.Rows[0]["pField3"].ToString();
        }
    }

Here’s how the the listview is defined:

    <div class="tab-content" style="width:1000px;">
           <h1 class="tab" title="title1">title1</h1>
           <asp:ListView runat= "server"   ID="somid" DataSourceID="ads" OnItemCommand="lv_PBP_click">
              <LayoutTemplate>
                <table  id="table1"  style="background-color:White;border-collapse:collapse;" width="100%">      
                <tr>                  
                    <td width="75%">    <asp:Button runat="server" ID="SortButton" 
                     Text="msg" CommandName="Sort" CommandArgument="pMessage" /></td>
                     <td>    <asp:Button runat="server" ID="LinkButton1" 
                     Text="F2 CommandName="Sort" CommandArgument="pField2" /> </td>
                    <td>    <asp:Button runat="server" ID="SortF3" 
                     Text="F3" CommandName="Sort" CommandArgument="pField3" /></td>
                  </tr>
                  <tr runat="server" id="itemPlaceholder" style="background-color:White" >
                  </tr> 
                </table>
                <asp:DataPager runat="server" ID="idxxx" PageSize="10" style="background-color:White">
                    <Fields> 
                      <asp:TemplatePagerField>              
                        <PagerTemplate>
                        <b>
                        Page
                        <asp:Label runat="server" ID="CurrentPageLabel" 
                          Text="<%# Container.TotalRowCount>0 ? (Container.StartRowIndex / Container.PageSize) + 1 : 0 %>" />
                        of
                        <asp:Label runat="server" ID="TotalPagesLabel" 
                          Text="<%# Math.Ceiling ((double)Container.TotalRowCount / Container.PageSize) %>" />
                        (
                        <asp:Label runat="server" ID="TotalItemsLabel" 
                          Text="<%# Container.TotalRowCount%>" />
                        records)
                        <br />
                        </b>
                        </PagerTemplate>
                      </asp:TemplatePagerField>

                      <asp:NextPreviousPagerField
                        ButtonType="Button"
                        ShowFirstPageButton="true"
                        ShowNextPageButton="false"
                        ShowPreviousPageButton="false" />

                      <asp:NumericPagerField 
                        PreviousPageText="&lt; Prev 10"
                        NextPageText="Next 10 &gt;"
                        ButtonCount="10" />

                      <asp:NextPreviousPagerField
                        ButtonType="Button"
                        ShowLastPageButton="true"
                        ShowNextPageButton="false"
                        ShowPreviousPageButton="false" />

                    </Fields>
                </asp:DataPager>
              </LayoutTemplate>
                <ItemTemplate>
                <tr id="Tr1" runat="server" style="background-color:#ECE5B6;" >
                    <td><asp:LinkButton runat="server" ID="ms1"   Text='<%# Eval("pMessage")%>'  CommandArgument='<%# Eval("pID") %>' /></td>
                    <td><asp:Label runat="server" ID="Label1"  Text='<%# Eval("pField2")%>'  /></td>
                    <td><asp:Label runat="server" ID="Status"  Text='<%# Eval("pSField3")%>' /></td>
                </tr>
                </ItemTemplate>
                <AlternatingItemTemplate>
                <tr id="Tr1" runat="server" style="background-color:#FAF8CC;" >
                    <td><asp:LinkButton runat="server" ID="ms2"   Text='<%# Eval("pMessage")%>'  CommandArgument='<%# Eval("pID") %>' /></td>
                    <td><asp:Label runat="server" ID="Label1"  Text='<%# Eval("pField2")%>'  /></td>
                    <td><asp:Label runat="server" ID="yyy"  Text='<%# Eval("pField3")%>' /></td>
                </tr>

                </AlternatingItemTemplate>

            </asp:ListView>
   </div>

The LinkButtons near the bottom of the code corresponds to the items in the listview which invoke the code behind in the first snippet above. I think I’m missing something fundamental about what buttons do. Maybe buttons (or linkbuttons) always do a page refresh (seems unlikely). Anyway, what I want to do is stop the page reload … how?

OTOH, maybe there’s some reason I should not stop this page reload … maybe the designers want this behavior. In that case, what should I do? Am I forced into ajax or is there another way to do this? (Just change the contents of some message boxes without the page refreshing… or refreshing into the exact same state it was left in so that it doesn’t look like it was refreshed.)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:59:43+00:00Added an answer on May 26, 2026 at 10:59 pm

    Your suspicion is correct.
    All interactions with the server involve a postback, which reloads the page.

    If you want the page to interact with the server without a postback, you need to use AJAX.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Vista, visual web developer express 2010, c#, asp.net, webforms. Running program with ctrl-F5. I'm
I have an ASP.NET MVC 3 .NET application under Visual web developer Express 2010.
Installed Visual Studio Web Developer 2010 Express from the ISO available from this page:
I am using microsoft visual web developer 2010 express edition. i want to create
After I add Google Chrome using Browse With.. in Visual Web Developer 2010 Express,
I'm using Visual Web Developer 2008 Express + Silverlight 3 Tools + Silverlight 3
I am building an ASP.NET MVC application using the 1.0 release using Visual Web
I've encountered a problem when developing on MS Visual Web Developer 2008 Express Ed.
I have Visual Studio web developer Addison , Visual Basic 2005 Express Edition, Visual
I'm new to Linq and Visual web developer 2008 Express. I have read some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.