How to refresh Radgrid [Resolved]

Posted by Vatcharm under ASP.NET AJAX on 2/24/2010 | Views : 26247 | Status : [Member] | Replies : 2
Hi Guru
I put Radgird and button into page when user clikc button radgrid display data that select from sql (not use SqlDataSource control) .
I have problem when user click page number 2 radgrid disble but repeated click button radgrid show data page2

help me please
thank you
protected void btnSearch_Click(object sender, EventArgs e)
{
string conStr = ConfigurationManager.ConnectionStrings["DCDBStr"].ToString();
SqlConnection myCon = new SqlConnection(conStr);
myCon.Open();
string sqlStr = string.Format("SELECT o.SOID,o.PONO,o.ShipTo,s.ShipToName,o.MaterialCode,m.MaterialName,o.Quantity,m.Units FROM ServiceOrders o LEFT JOIN Materials m ON m.MaterialCode = o.MaterialCode LEFT JOIN ShipToParty s ON s.ShipTo=o.ShipTo WHERE PONO='{0}'", txtPONO.Text);
SqlDataAdapter da = new SqlDataAdapter(sqlStr, myCon);
DataSet ds = new DataSet();
da.Fill(ds, "x");
DataTable dt = ds.Tables["x"];
if (dt.Rows.Count > 0)
{
RadGrid1.DataSource = dt;
RadGrid1.DataBind();
}
else
{
RadAjaxManager1.Alert("No Invoice");
}

}





Responses

Posted by: Vuyiswamb on: 2/24/2010 [Member] [MVP] [Administrator] NotApplicable

Up
0
Down

Resolved
So you want Paging in Radgrid ?

If so look at this Article
http://www.dotnetfunda.com/articles/article307-paging-without-a-wizard-sqldatasource-control-in-aspnet-.aspx

and in your Radgrid use

protected void RadGrid1_PageIndexChanged(object source, GridPageChangedEventArgs e) 

{
int Index = RadGrid1.CurrentPageIndex;
//rebind the Grid as shown in the above article
}


Thank you for Posting at Dotnetfunda

Vuyiswa Maseko

Thank you for posting at Dotnetfunda
[Administrator]

Vatcharm, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Nishithraj on: 2/24/2010 [Member] Bronze

Up
0
Down
Compare your aspx with the following

http://www.sitefinity.com/support/forums/sitefinity-3-x/developing-with-sitefinity/issue-with-radgrid-paging.aspx

Mark this as answer, if it is.....

With regards
Nishithraj Narayanan

Vatcharm, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response