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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T05:55:14+00:00 2026-05-20T05:55:14+00:00

I have a gridview inside an updatepanel and I have a javascript that calls

  • 0

I have a gridview inside an updatepanel and I have a javascript that calls a page method using jquery. I’d like the page method to refresh the gridview based on the parameter it receives from the ajax call.

So far, I have the following:

1) in the javascript, there’s a function that calls the page method:

function GetNewDate(thedateitem) {

    DateString = (valid json date format that works)

    $.ajax({
        type: "POST",
        url: "./CallHistory.aspx/ResetDate",
        contentType: "application/json; charset=utf-8",
        data: DateString,
        dataType: "json",
        success: successFn,
        error: errorFn
    }) 
};

2) In the aspx page I have:

    <asp:UpdatePanel ID="MyPanel" runat="server">
        <ContentTemplate>
                <asp:GridView ID="MyGrid">

3) In the code behind:

public partial class Pages_CallHistory : System.Web.UI.Page
{
    List<ViewCallHistoryModel> TheCallHistory;

    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            TheDate = new DateTime(2011, 1, 13);
            LoadCallHistory(TheDate);
            MyGrid.Datasource = TheCallHistory;
            MyGrid.Databind;
        }
    }

    protected void LoadCallHistory(DateTime TheDate)
    {
        linq query that fills the variable TheCallHistory
    }

    [WebMethod]
    public static void ResetDate(DateTime TheNewDate)
    {
        var test = new Pages_CallHistory();
        var test2 = test.LoadCallHistory(TheNewDate.Date);
        //test2 loads fine

        test.GridCallHistory.DataSource = test2; 
        //this is not underlined but bugs at runtime
        //Object reference not set to an instance of an object.

        test.GridCallHistory.DataBind();
        test.MyPanel.Update(); 
        //this is not underlined but doesn't get executed because
        //because it stops at the line above

        //I'd like to update the content of 
        //the gridview on the page with the updated gridview.
    }

What I’d like to do in the page method is 1) call LoadCallHistory with the new date parameter and 2) tell the gridview MyGrid to rebind with the new data that’s in TheCallHistory.

I’m struggling with this page method; it’s not working and I’m stuck. How is this done?

  • 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-20T05:55:14+00:00Added an answer on May 20, 2026 at 5:55 am

    ok so the solution is to use _doPostBack in javascript:

       __doPostBack('MyPanel', DateString);
    

    The page method is for sending and receiving data only, not for doing postbacks on updatepanels.

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

Sidebar

Related Questions

I have a GridView that is inside of an UpdatePanel. I am using the
i'm using an gridview inside the update panel.now in that grid i have 3
I have a simple situation that does not work. Gridview is nested inside updatepanel
I have a gridview inside updated panel on parent page which is populated based
I have a GridView inside an UpdatePanel that is populated when a search is
I have a gridview inside of an updatepanel and would like to allow the
I have the following gridview that is inside an updatepanel: <asp:UpdatePanel ID=UpdatePanel1 runat=server> <ContentTemplate>
I have a gridview inside an updatepanel. It has a TemplateField column with radiobutton:
I've got an asp.net gridview inside an updatepanel. One of the fields I have
I have a gridview inside an update panel, that is doing inline editing. When

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.