Link to home
Start Free TrialLog in
Avatar of thomasmutton
thomasmuttonFlag for United Kingdom of Great Britain and Northern Ireland

asked on

GridView Paging Postback Issue

Hello there,

I have a Gridview which is set to page. The problem is that I also have a button which executes a function. This function will only work if the databinding is in a if statement for !postback.

Whenever I try to page this GridView it gives me a blank page. I know why this is but is there a work around for it?

Thanks
protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            GridView1.DataSource = ImageList.GetImages();
            GridView1.DataBind();
        }
    }
 
    protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GridView1.PageIndex = e.NewPageIndex;
        GridView1.DataBind();
    }

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Avodah
Avodah
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial