Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have used gridview to bind data. in binding grid view i need two parameters,em getting both from query string but to make code more readable i have used enum everything is working fine but paging in gridview is not working my code is
C#
 public static Enum TenderCategory;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Convert.ToInt32(Request.QueryString["Category"]) == Convert.ToInt32(ValueTypeGroupEnum.ValueTypeGroup.State))
            {
                BindCategoryTenderList(ValueTypeGroupEnum.ValueTypeGroup.State, Convert.ToInt32(Request.QueryString["TenderCategoryID"]));
            }
        }
      }

private void BindCategoryTenderList(Enum TenderCategory, int TenderCategoryID)
    {
        try
        {
            TenderCategoryID = Convert.ToInt32(Request.QueryString["CategoryID"]);
            List<TenderManagement.Model.TenderDetail> tenderListByCategory = new List<TenderManagement.Model.TenderDetail>();
            tenderListByCategory = BLLTender.GetAllTenderByCategory(TenderCategory, TenderCategoryID);
            gvTenderListByCategory.DataSource = tenderListByCategory;
            gvTenderListByCategory.DataBind();
        }
        catch (Exception ex)
        { 

        }
    }

    protected void gvTenderListByCategory_PageIndexChanging(object sender, System.Web.UI.WebControls.GridViewPageEventArgs e)
    {
        gvTenderListByCategory.PageIndex = e.NewPageIndex;
        DataBind();
        BindCategoryTenderList(TenderCategory, Convert.ToInt32(Request.QueryString["CategoryID"]));
    }


 public static class ValueTypeGroupEnum
    {
        public enum ValueTypeGroup
        {
            Region = 1,
            Country = 2,
            State = 3,
            Ministry = 4,
            Organization_Type = 5,
            Product_Category = 6,
            Tender_Type = 8,
            Organization_Name = 10,
            City = 11,
            SubProductCategory=12
        }
    }


can anyone help plz...
Posted
Comments
[no name] 9-Aug-13 6:21am    
What is there in DataBind() method?
Vishal Pand3y 9-Aug-13 7:08am    
Binds a data source to the invoked server control and all its child controls.
Vishal Pand3y 9-Aug-13 7:43am    
Any suggestion ???
woopsydoozy 9-Aug-13 9:18am    
We're not seeing everything, so hard to tell. I'd suggest putting a break point at the start of BindCategoryTenderList. When it hits there, is gvTenderListByCategory.PageIndex still set to what you want? If so, is your exception handler getting hit?
Vishal Pand3y 9-Aug-13 11:00am    
the problem is while clicking on any page number TenderCategory which is enum is null. i got the value of this from query string but while paging value of enum sets to null

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900