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 6913469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T09:13:23+00:00 2026-05-27T09:13:23+00:00

Specified argument was out of the range of valid values. Parameter name: value Description:

  • 0
Specified argument was out of the range of valid values.
Parameter name: value
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: value

Source Error:

Line 95:     protected void changed(object sender, GridViewPageEventArgs e)
Line 96:     {
Line 97:         GridView1.PageIndex = e.NewPageIndex;
Line 98:         //GridView1.DataBind();
Line 99:     }


Source File: c:\Users\Sartaj\Desktop\web\Websites\Asp_website_projectv1\AddInventory.aspx.cs    Line: 97

Stack Trace:

[ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
Parameter name: value]
   System.Web.UI.WebControls.GridView.set_PageIndex(Int32 value) +1318287
   AddInventory.changed(Object sender, GridViewPageEventArgs e) in c:\Users\Sartaj\Desktop\web\Websites\Asp_website_projectv1\AddInventory.aspx.cs:97
   System.Web.UI.WebControls.GridView.OnPageIndexChanging(GridViewPageEventArgs e) +133
   System.Web.UI.WebControls.GridView.HandlePage(Int32 newPage) +86
   System.Web.UI.WebControls.GridView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup) +464
   System.Web.UI.WebControls.GridView.RaisePostBackEvent(String eventArgument) +207
   System.Web.UI.WebControls.GridView.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565


My gridview is->
<asp:GridView ID="GridView1" runat="server" EnableModelValidation="True" AutoGenerateColumns="true" 
        BackColor="#CCCCCC" BorderColor="Black" BorderStyle="None" BorderWidth="1px" 
        CellPadding="7" CellSpacing="5" AllowPaging="True" PageSize="1" OnPageIndexChanging="changed" >
                    <PagerSettings Mode="NextPrevious" />
                    <FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />
                    <HeaderStyle BackColor="#999999" Font-Bold="True" ForeColor="White" />
                    <PagerStyle ForeColor="#0033CC" HorizontalAlign="Center" />
                    <RowStyle BackColor="Silver" ForeColor="White" />
                    <SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />
                </asp:GridView>

**my backend code is->**
protected void addInventoryButton_Click(object sender, EventArgs e)
    {
        addInventoryAllSelectDataSource.InsertParameters[0].DefaultValue = imeiText.Text;
        addInventoryAllSelectDataSource.InsertParameters[1].DefaultValue = carrierDropDown.SelectedValue;
        addInventoryAllSelectDataSource.InsertParameters[2].DefaultValue = ((int)d1[modelDropDown.SelectedIndex][0]).ToString();
        addInventoryAllSelectDataSource.InsertParameters[3].DefaultValue = costPriceText.Text;
        addInventoryAllSelectDataSource.InsertParameters[4].DefaultValue = sellingPriceText.Text;
        addInventoryAllSelectDataSource.InsertParameters[5].DefaultValue = dateText.Text;
        addInventoryAllSelectDataSource.InsertParameters[6].DefaultValue = smartphoneRadioList.SelectedValue;
        addInventoryAllSelectDataSource.InsertParameters[7].DefaultValue = transferOrderNoText.Text;
        addInventoryAllSelectDataSource.InsertParameters[8].DefaultValue = Session["user"].ToString();
        addInventoryAllSelectDataSource.Insert();
       // gridList.Add(new AddImei(imeiText,carrierDropDown.SelectedValue,(((int)d1[modelDropDown.SelectedIndex][0]).ToString())
           // ,Convert.ToDouble(costPriceText.Text),Convert.ToDouble(sellingPriceText.Text),dateText.Text);
        //GridView1.DataSource = gridList;
        //GridView1.DataBind();
        //GridView1.DataSource = selectInventoryDataSource.Select(DataSourceSelectArguments.Empty);
        //GridView1.DataBind();
        addInventoryAllSelectDataSource.SelectCommand = "SELECT A.IMEI,A.CARRIER, F.MAKE, F.MODEL, A.COST_PRICE,A.SELLING_PRICE,A.DATE,A.SMARTPHONE,A.TRANSFER_ORDER_NO,A.USER_ID FROM AddInventory AS A FULL OUTER JOIN "+carrierDropDown.SelectedValue+" AS F ON A.CARRIER_ID_INVENTORY = F.CARRIER_ID WHERE (A.IMEI = '"+imeiText.Text+"')";
        d3  = (DataView)addInventoryAllSelectDataSource.Select(DataSourceSelectArguments.Empty);
        gridList.Add(new AddImei(d3[0][0].ToString(), d3[0][1].ToString(), d3[0][2].ToString(), d3[0][3].ToString(), Convert.ToDouble(d3[0][4]), Convert.ToDouble(d3[0][5]), Convert.ToDateTime(d3[0][6]).Date, Convert.ToBoolean(d3[0][7]), d3[0][8].ToString(), d3[0][9].ToString()));
        //AddImei ob1=new AddImei(d3[0][0].ToString(), d3[0][1].ToString(), d3[0][2].ToString(), d3[0][3].ToString(), Convert.ToDouble(d3[0][4]), Convert.ToDouble(d3[0][5]), Convert.ToDateTime(d3[0][6]).Date, Convert.ToBoolean(d3[0][7]), d3[0][8].ToString(), d3[0][9].ToString());
        GridView1.DataSource = gridList;
        GridView1.DataBind();
    }

The issue is that when i click next page, it does not change page, i click again then the page changes. After going to next page, i click on the previous page nothing changes, i click again and then i get the above exception. i have been looking to sort this issue for hours, cant figure out what i am doing wrong here.

  • 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-27T09:13:24+00:00Added an answer on May 27, 2026 at 9:13 am

    you have to call the function that fill the GridView1 after the PageIndexChanged Event

     protected void changed(object sender, GridViewPageEventArgs e)
     {
         GridView1.PageIndex = e.NewPageIndex;
         this.fillGridView1();
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Error : specific argument was out of range of valid value parameter name :
Is there a simple way of finding out the current value of a specified
I want to create a macro whose argument is optional. If not specified, the
the link specified below is a jquery timer plugin. http://keith-wood.name/countdown.html Also i use the
`postgresql_connection': No database specified. Missing argument: database. (ArgumentError) I installed postgresql using Homebrew and
I have this script that is meant to trim the field specified as argument
I'm trying to start a service that has a argument that specifies a port
Ive specified white backgrounds for pretty much all widgets and it works, except when
Both: CLSID IID Having specified the above, and using: CoCreateInstance() To returning a single
The Python docs say: re.MULTILINE: When specified, the pattern character '^' matches at the

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.