This is a migrated thread and some comments may be shown as answers.

Grid Value Not showing

1 Answer 81 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Joby
Top achievements
Rank 1
Joby asked on 15 Nov 2010, 10:42 AM

Hi, I have one telerik rad grid.Using a method i am filling the grid.I have enabled paging property.I have used itemtemplate-->ImageButton for delete and edit options.I have set page size as 10.Page load time it is working properly and populating the grid.After inserting 11 th row the pagination starts and it will show in next page with one record.But when i am deleting the 11th row the grid become blank.I have used dataset to bind the records. radgrid.DataBind(); dsDataset.Dispose();. But its item.count is 0. What is the reason?

protected void Page_Load(object sender, EventArgs e)
   
{
       
try
       
{
           
if (!IsPostBack)
           
{
               
PopulatePackage();
           
}
       
}
       
catch (Exception ex)
       
{
            lblMessage
.Text = objUtl.GetErrorMessage(ex, this);
            lblMessage
.Visible = true;


protected void gvPackage_NeedDataSource(object source, GridNeedDataSourceEventArgs e)
   
{
       
try
       
{
           
SqlHelper objSQL = new SqlHelper();
           
DataSet dsPackage = new DataSet();
            dsPackage
= objSQL.ExecuteDataset("AL_PackageType_List_Retrieve",
                                             objUtl
.NumericEntry(Session["LocationId"].ToString()));
            gvPackage
.DataSource = dsPackage.Tables[0];
            dsPackage
.Dispose();
           
//PopulatePackage();
       
}
       
catch (Exception ex)
       
{
            lblMessage
.Text = objUtl.GetErrorMessage(ex, this);
            lblMessage
.Visible = true;
       
}
   
}





private void PopulatePackage()
   
{
       
try
       
{
            lblMessage
.Text = string.Empty;
           
SqlHelper objSQL = new SqlHelper();
           
DataSet dsPackage = new DataSet();
            dsPackage
= objSQL.ExecuteDataset("AL_PackageType_List_Retrieve",
                                             objUtl
.NumericEntry(Session["LocationId"].ToString()));
            gvPackage
.DataSource = null;
            gvPackage
.DataSource = dsPackage.Tables[0];
            gvPackage
.DataBind();
           
//dsPackage.Dispose();
           
if (gvPackage.Items.Count <= 0)
           
{
                lblMessage
.Text = "No Package Details Found...";
                gvPackage
.Visible = false;
           
}
           
else
           
{
                gvPackage
.Visible = true;
           
}
       
}
       
catch (Exception ex)
       
{
            lblMessage
.Text = objUtl.GetErrorMessage(ex, this);
            lblMessage
.Visible = true;
       
}
   
}

1 Answer, 1 is accepted

Sort by
0
Tsvetina
Telerik team
answered on 18 Nov 2010, 10:40 AM
Hi Joby,

RadGrid does not support paging and CRUD operations with simple data-binding, so please replace it with advanced data-binding through the NeedDataSource event handler. The articles I linked to explain the differences between the two in more detail.

Regards,
Tsvetina
the Telerik team
Browse the vast support resources we have to jumpstart your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
Tags
Grid
Asked by
Joby
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
Share this question
or