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

  • SEARCH
  • Home
  • 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 6949029
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:54:03+00:00 2026-05-27T13:54:03+00:00

I have code to have a dynamic button appear after it does an if

  • 0

I have code to have a dynamic button appear after it does an if else loop for checking for some data.

however, the gridview cant do any paging. it only shows the first page and cant go to 2nd page and so on.
It only can do the paging IF i nvr call the method below.

here is my code

 public void filter_select(object sender, GridViewRowEventArgs e)
{ 
 if (e.Row.RowType == DataControlRowType.DataRow)
    {
     ........                
            }

that method will be called on the rowdatabound gridview page source like this OnRowDataBound="filter_select"

my gridview code on source code is :

<asp:GridView ID="GridView1" runat="server" AllowPaging="True" CellPadding="2" CellSpacing="2" 
     HorizontalAlign="Center" OnRowCommand="stop_survey" 
       OnRowDataBound="filter_select" OnSelectedIndexChanging="selected" PageSize="5" 
    Width="133%" DataKeyNames="SurveyID" DataSourceID="SqlDataSource1" AutoGenerateColumns="False" 
        >
          <Columns>

                                    <asp:BoundField DataField="SurveyID" HeaderText="Survey ID" ReadOnly="True" 
                                    .........

my onrowCommand code

 public void stop_survey(object sender, GridViewCommandEventArgs e)
{
    SqlConnection con;
    string sqlcom;
    SqlCommand cmd;

    //is it because of this code below? as if i comment from this code onwards, the paging works.
    GridViewRow row = (GridViewRow)((Button)e.CommandSource).NamingContainer;
    Button btn = (Button)GridView1.Rows[row.RowIndex].FindControl("btnStop");
    ...............
  • 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-27T13:54:03+00:00Added an answer on May 27, 2026 at 1:54 pm

    Rebind your gridview in the PageIndexChanging event of the gridview control

    protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
            {
                GridView1.PageIndex = e.NewPageIndex;
                GridView1.DataSource = DataAcceessLayer.GetEmployeeData();
                GridView1.DataBind();
            }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some PHP code that generates dynamic tables of data on the fly.
I have a dialog appear when i press a button with dynamic data but
i have created dynamic button with code below, the button caption is too long
I have used the following code to generate some dynamic checkboxes. This works for
I have a dynamic forms with checkbox/radio-button lists & matrices: Following code renders checkbox
Working on some dynamic pages and specifically we have profile pages for users. However
I have an idea of how I can improve the performance with dynamic code
I have a piece of performance critical code written with pointers and dynamic memory.
Since Python is a dynamic, interpreted language you don't have to compile your code
I have code to create another row (div with inputs) on a button click.

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.